Patch level :2.1 022

Files correlati     :xvagadll.dll
Ricompilazione Demo : [ ]
Commento            :sistemato il problema delle licenze con terminal server;adesso vale la sessione


git-svn-id: svn://10.65.10.50/trunk@11935 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2004-04-06 08:51:56 +00:00
parent 9f9dc7cea1
commit f44c7717da

View File

@ -804,19 +804,21 @@ bool OsWin32_Speak(const char* text, bool async)
#endif #endif
typedef BOOL (PASCAL *pfnProcessIdToSessionId)(DWORD dwProcessId,DWORD* pSessionId);
int OsWin32_GetSessionId() int OsWin32_GetSessionId()
{ {
const wxString str = wxGetUserId(); //modifiche del 5/4/04 per poter gestire le licenze con win2000/2003 server edition
DWORD session = 0;
HMODULE kernel = GetModuleHandle("kernel32.dll");
unsigned short h = 0; if (kernel != NULL)
for (const char* s = str; *s; s++)
{ {
h = (h << 2) + *s; pfnProcessIdToSessionId fn = (pfnProcessIdToSessionId)GetProcAddress(kernel, "ProcessIdToSessionId");
const unsigned short i = h & 0xC000; if (fn != NULL)
if (i) h = (h ^ (i >> 12)) & 0x3FFF; fn(GetCurrentProcessId(), &session);
} }
return (int) session;
return (int) h;
} }
#define BUFSIZE 80 #define BUFSIZE 80