incorrect parameter passing in 64-bit dll

  • Thread starter Thread starter dgadomski
  • Start date Start date
D

dgadomski

Guest
I am currently migrating an application and dll from 32-bit to 64-bit. All is currently in VS2010. Works fine in the 32 bit version, but when I make a call into the dll from the application, I'm having a problem with the input parameters. When debugging the 64-bit dll, I'm finding that the parameter is not being correctly interpreted. The call from the application is as follows:

unsigned short tmpId = 123;
SetDisExerciseId(tmpId);


when looking at the dll side, the routine is being properly called and a breakpoint is reached, but the value that is being passed in is not correctly. Below is a screen capture showing the value passed in (in hex) along with the current registry window. It appears that it is using the value in the RDX register (as an unsigned short) instead of the value in the RCX register (0x7b = 123).

I tried posting an image showing the value and the registers, but unfortunately, I'm unable to post an image yet as it is my first post on the forum. Will add image to the post when I'm able to do so, but the value of the parameter is shown as 0xebb0, the RCX register value is 000000000000007B and the value of the RDX register is 000000000029EBBO.



I'm really puzzled on why this is happening. I have been beating my head against my monitor for two days and it doesn't seem to help. ;) Is there possibly a wrong setting in the project that is causing this?

Thank you very much, in advance, for any help that you can give.

Continue reading...
 
Back
Top