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:
parent
9f9dc7cea1
commit
f44c7717da
@ -804,19 +804,21 @@ bool OsWin32_Speak(const char* text, bool async)
|
||||
|
||||
#endif
|
||||
|
||||
typedef BOOL (PASCAL *pfnProcessIdToSessionId)(DWORD dwProcessId,DWORD* pSessionId);
|
||||
|
||||
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;
|
||||
for (const char* s = str; *s; s++)
|
||||
if (kernel != NULL)
|
||||
{
|
||||
h = (h << 2) + *s;
|
||||
const unsigned short i = h & 0xC000;
|
||||
if (i) h = (h ^ (i >> 12)) & 0x3FFF;
|
||||
pfnProcessIdToSessionId fn = (pfnProcessIdToSessionId)GetProcAddress(kernel, "ProcessIdToSessionId");
|
||||
if (fn != NULL)
|
||||
fn(GetCurrentProcessId(), &session);
|
||||
}
|
||||
|
||||
return (int) h;
|
||||
return (int) session;
|
||||
}
|
||||
|
||||
#define BUFSIZE 80
|
||||
|
Loading…
x
Reference in New Issue
Block a user