Accessing exported variable in .asm file

Hi,

After few trials I could get a procedure to be declared in .asm as something like:

extrn __imp__PsGetCurrentThreadId@0: proc

But for a variable, I am not sure what is to be mentioned instead of ‘proc’ on the similar lines.

Can you let me know.

Thanks
Sudhakar

That’s a DLL import. It’s extremely rare to have a variable exported from a DLL. If you’re just trying to hook to a variable from some other .obj in the link, use
extrn totalModuleCount: dword
or substitute the appropriate type.

Thanks Tim for the reply.

I am not sure if it is a rare need but I was trying to access a variable defined in the first module which gets loaded to control the function instrumentation calls with _penter in remaining modules.

“defined in the first module” doesn’t tell us anything. Are you trying to connect to a variable in another .obj, or do you actually have a variable exported from a DLL? The methods are very different.

We have many driver modules. The first of the modules which gets loaded has the variable defined. This is made as export driver. So the .lib is specified during link time to access the variable in other modules. So it is not from .obj.