PDA

View Full Version : shared memory not working ?


Mouton
06-14-2003, 10:57 AM
on ioftpd 4.9.4r
to use shared memory, in the initialisation, i do:

hShell32 = LoadLibrary("shell32.dll");
if ( Target && hShell32 )
{
Allocate = GetProcAddress(hShell32, "SHAllocShared");
Free = GetProcAddress(hShell32, "SHFreeShared");
Unlock = GetProcAddress(hShell32, "SHUnlockShared");
Lock = GetProcAddress(hShell32, "SHLockShared");

if ( Allocate && Free && Lock && Unlock && hTarget )
{ ... }
else {
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL );
printf("Error on Allocate. Error: %lX - %s\n",GetLastError(),lpMsgBuf); fflush(stdout);
}
}this works ok on some pc, but on others:

Error on Allocate. Error: 7F - Kan opgegeven procedure niet vinden.

(means "Can't find the procedure that you filled in.")

Wasn't shared memory supposed to work on all WinNT kernel based OS now ..?
I get this on Win2k and some else reported this happening on WinXP SP1 too :\
While on another SP1, it works ok...

FTPServerTools
06-14-2003, 04:24 PM
Use call by ordinal for win2k.
Shared memory works for all but it isnt defined that way for all shell32.dll versions.

Mouton
06-16-2003, 07:26 PM
Thx.

Off the record, for those who that might interest:

//Allocate = GetProcAddress(hShell32, "SHAllocShared");
Allocate = GetProcAddress(hShell32, (char *)520);
//Free = GetProcAddress(hShell32, "SHFreeShared");
Free = GetProcAddress(hShell32, (char *)523);
//Unlock = GetProcAddress(hShell32, "SHUnlockShared");
Unlock = GetProcAddress(hShell32, (char *)522);
//Lock = GetProcAddress(hShell32, "SHLockShared");
Lock = GetProcAddress(hShell32, (char *)521);

phoenixfr
06-17-2003, 07:20 AM
thanks Mouton , im thinking about plmaying a bit with it on win2k :)