• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Reply to: Hard 'C' Question

Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Hard 'C' Question"

Collapse

  • OrangeHopper
    replied
    Come on then Suityou, did you get this sorted?

    Leave a comment:


  • VectraMan
    replied
    Put a sizeof somewhere in your code to check the size. I.e. sizeof(LPVOID), and sizeof(LPLISTENTRY) you'd expect to return 4. And also do the same for the whole structure to make sure they're the same.

    If structures don't match across modules compiled seperately, then chances are it's alignment (i.e. one is set to align members to bytes, the other to align to 4 bytes). If not that, then another explanation could be if any part of the structure has #ifs which evaluate differently. sizeof should tell you if that's the case.

    Leave a comment:


  • OrangeHopper
    replied
    Pointers can be different lengths from one program to another. It depends on how you have compiled them.

    Have you checked what byte alignment is in place? I seem to recall that intel chips allow different policies on demand. Been a while so the up-to-date experts such as scots could correct me on this one.

    Leave a comment:


  • suityou01
    replied
    Still not working out for me.

    I have a structure in Kernel mode defined as

    NET_BUFFER_LIST*

    now my user mode app does not know what a NET_BUFFER_LIST is so I declared it as PVOID.

    All other members in the struct after the NET_BUFFER_LIST has garbled data.

    So the question is

    What's the difference in size between a PVOID and a NET_BUFFER_LIST*

    Nothing shirley as they're both pointers?

    Leave a comment:


  • suityou01
    replied
    Originally posted by scotspine View Post
    "so .Netters need not apply" - meaning we have no knowledge of machine code, assembly, instruction sets, direct mode addressing, indirection, bitshift etc? kids stuff!!
    pretty much, yes.

    HTH

    Leave a comment:


  • suityou01
    replied
    Originally posted by scotspine View Post
    Err .... you create a U/m include file for your struct.

    There it might not include your LIST_ENTRY field, you just have to
    cope with this in the K/M data copy routines.

    Or, you can cut and paste the LIST_ENTRY definition in to the U/m include file.

    Or create a dummy version of your own devising using PVOID.

    Basic C programming.
    Sharing memory between user mode and kernel mode is basic C programming?

    Leave a comment:


  • scotspine
    replied
    "so .Netters need not apply" - meaning we have no knowledge of machine code, assembly, instruction sets, direct mode addressing, indirection, bitshift etc? kids stuff!!

    Leave a comment:


  • scotspine
    replied
    Err .... you create a U/m include file for your struct.

    There it might not include your LIST_ENTRY field, you just have to
    cope with this in the K/M data copy routines.

    Or, you can cut and paste the LIST_ENTRY definition in to the U/m include file.

    Or create a dummy version of your own devising using PVOID.

    Basic C programming.

    Leave a comment:


  • AtW
    replied
    Originally posted by d000hg View Post
    Oh, I thought you meant standard 64-bit ASM which seemed weird. If you are doing parallel data processing then ASM makes sense, it's really interesting.
    Have you tried the Intel compiler?
    Yes Intel compiler is the best. Visual Studio C++ dropped support for inline asm in 64-bit compiles

    Leave a comment:


  • Sysman
    replied
    Originally posted by d000hg View Post
    Assembly is a little more past it than C. What are you doing that can't be achieved using intrinsics BTW? The only time ASM seems needed these days is in SIMD, where you can get massive improvements.
    From my stash of quotes:

    Originally posted by Somewhere on da Web
    Watching discussions of string and macro handling in C. And complaints. C is supposed to be assembler. If that bugs you, use something else.

    Leave a comment:


  • d000hg
    replied
    Oh, I thought you meant standard 64-bit ASM which seemed weird. If you are doing parallel data processing then ASM makes sense, it's really interesting.
    Have you tried the Intel compiler?

    Leave a comment:


  • AtW
    replied
    Originally posted by d000hg View Post
    Assembly is a little more past it than C. What are you doing that can't be achieved using intrinsics BTW? The only time ASM seems needed these days is in SIMD, where you can get massive improvements.
    Intrinsics suck arse - I tried them first but found bug in VS 2008 that was causing wrong calculations, confirmed by Microsoft, and yes I was trying to use new SSE4.2 SIMD...

    Leave a comment:


  • d000hg
    replied
    Originally posted by AtW View Post
    Someone is still using C? That's a blast from the past - installing C++ compiler just now as VS C++ is total tulipe when it comes to inlined assembly in 64 bit mode
    Assembly is a little more past it than C. What are you doing that can't be achieved using intrinsics BTW? The only time ASM seems needed these days is in SIMD, where you can get massive improvements.

    Leave a comment:


  • minestrone
    replied
    Ten years since I did a bit of C and you have brought the fears right back posting that bit of code.

    *shivers*

    Leave a comment:


  • HairyArsedBloke
    replied
    Originally posted by suityou01 View Post
    I have written a Kernel mode filter driver....
    'king 'ell! I was lost after 'Kernel'

    I am soooooooo out of this game.

    Leave a comment:

Working...
X