![]() |
| Re: InjectDll method |
|
tzuk
|
Try to run the program in a (64-bit) debugger to get a better sense of what's wrong. You can post the debugger log here and we can take a look at it together. If you need some quick starter for using the Microsoft windbg debugger, then take a look here:
http://www.sandboxie.com/index.php?HowToUseWinDbg |
||||||||||||
|
_________________ tzuk |
|||||||||||||
|
rcbblgy
|
snipped. --tzuk |
||||||||||||||
|
|
|||||||||||||||
|
rcbblgy
|
Hello, tzuk, is that useful ? |
||||||||||||||
|
|
|||||||||||||||
|
rcbblgy
|
This is my test x64 program error info snipped. --tzuk |
||||||||||||||
|
|
|||||||||||||||
|
rcbblgy
|
A question, how to get the path of sandboxie installed ?
|
||||||||||||
|
|
|||||||||||||
|
tzuk
|
Thanks for the debug log. Here is the explanation. The machine code for the function user32!AttachThreadInput has been generated "within" (conceptually) the range that is used by the function user32!GetWindowFrameMetricInternal. The Microsoft compiler does that all the time, so we have nothing to do about that.
Now the thing is that AttachThreadInput is a very small function. Hooking the function actually overwrites the machine code. So if the code placed by the hook is longer than the original code bytes for AttachThreadInput, then the result is that it actually "overflows" and overwrites partts of GetWindowFrameMetricInternal. I hope I am explaining this reasonably good. Sandboxie can overwrite with very short hook code (5 bytes) if the hooked function (AttachThreadInput) and the target function (in your DLL) are less than 2GB apart in memory. If they are farther away than this then Sandboxie needs to overwrite 12 bytes. So the solution is simple, compile your DLL with a fixed base address that is in the lower 2GB range (because that is where USER32 gets loaded.) And that should shorten the hook code from 12 bytes to 5 bytes and should fix this problem. |
||||||||||||
|
Last edited by tzuk on Tue Nov 02, 2010 11:32 am; edited 1 time in total |
|||||||||||||
|
tzuk
|
As for getting the Sandboxie installation directory: I do have an API for getting this information but it's not exported. For now hard code C:\Program Files\Sandboxie or whatever, I'll make this API accessible in the next beta build of Sandboxie.
|
||||||||||||
|
|
|||||||||||||
|
rcbblgy
|
Hi, tzuk, thanks a lot for your help, I get it, so I should complie the dll with /FIXED option, both of the 32bit dll and 64bit dll, is that right ?
About getting the path of sandboxie, I maybe could get it from the key path "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SbieSvc\ImagePath", if sandboxie is running, I think it will be OK. I found this tool (http://www.sandboxie.com/phpbb/viewtopic.php?t=6128) will load the SbieDll when it runs, I don't know how it get the dll path, I use it all the time, but I am very sad to say , it can't work with v3.50
If a sandboxed program could get the sbie path, it is very comfortable to the injectdll And my dll is designed for v3.46 and v3.50, so I use LoadLibrary to get the HMODULE of user32.dll in the InjectDllMain function, but I should use GetModuleHandle for old sbie versions, I want to know is there any other diffrence between old and new versions ? if there isn't, my dll could also be used in old versions, is that right ? |
||||||||||||||
|
Last edited by rcbblgy on Tue Nov 02, 2010 2:41 pm; edited 1 time in total |
|||||||||||||||
|
rcbblgy
|
Hi, tzuk, could you give me some suggestion about the Zemana keylogger test tool, I really don't know how to debug it to find why my dll can't block it , thanks
|
||||||||||||
|
|
|||||||||||||
|
tzuk
|
rcbblgy you already asked me that and I declined. As you see I do try to help you where the problems are related to Sandboxie. But you're asking me to spend 2-3 hours or more in the debugger to figure out how some keylogger test tool works, and I'm sorry, but no. I'm imagining a scenario where everyone drops by to ask me to debug their favorite problem that has little or nothing to do with Sandboxie. Try to understand.
|
||||||||||||
|
|
|||||||||||||
|
rcbblgy
|
Don't be angry, tzuk, |
||||||||||||||
|
|
|||||||||||||||
|
tzuk
|
I'm not angry. But I'm also not familiar with key logging so I'm afraid I can't help you there.
|
||||||||||||
|
|
|||||||||||||
|
rcbblgy
|
With the version 3.50, there is no "sanboxie service stop working" error, and the zemana test tool also could be blocked in win7 64bit, but still can't be blocked in xp 32bit, I decide to leave it away |
||||||||||||||
|
|
|||||||||||||||
|
tzuk
|
In version 3.51.10, I added a new API to get the Sandboxie installation folder:
http://www.sandboxie.com/index.php?SBIE_DLL_API#HomePath |
||||||||||||
|
|
|||||||||||||
| InjectDll method |
|
||
|


Use the RSS feed to watch this topic for replies