8356 ]. |
8356 ]. |
8357 ^ name |
8357 ^ name |
8358 |
8358 |
8359 " |
8359 " |
8360 OperatingSystem primGetHostName |
8360 OperatingSystem primGetHostName |
|
8361 " |
|
8362 ! |
|
8363 |
|
8364 primRtlGenRandomInto:buffer |
|
8365 "fill a given buffer with random bytes from the RtlGenRandom function" |
|
8366 |
|
8367 %{ |
|
8368 // BOOLEAN RtlGenRandom( |
|
8369 // __out PVOID RandomBuffer, |
|
8370 // __in ULONG RandomBufferLength |
|
8371 // ); |
|
8372 static BOOL (__stdcall *P_RtlGenRandom)(PVOID , ULONG) = 0; |
|
8373 unsigned char *__buffer; |
|
8374 int __bufferSize; |
|
8375 |
|
8376 if (__isString(buffer)) { |
|
8377 __buffer = __stringVal(buffer); |
|
8378 __bufferSize = __stringSize(buffer); |
|
8379 } else { |
|
8380 if (__isByteArray(buffer)) { |
|
8381 __buffer = __byteArrayVal(buffer); |
|
8382 __bufferSize = __byteArraySize(buffer); |
|
8383 } else { |
|
8384 goto error; |
|
8385 } |
|
8386 } |
|
8387 |
|
8388 if (P_RtlGenRandom == 0) { |
|
8389 HINSTANCE hAdvapi32 = LoadLibrary("advapi32.dll"); |
|
8390 // console_printf("hAdvapi32: %x\n", hAdvapi32); |
|
8391 console_printf("hAdvapi32: %x\n", hAdvapi32); |
|
8392 if (hAdvapi32) { |
|
8393 P_RtlGenRandom = (BOOL (__stdcall *)(PVOID , ULONG)) |
|
8394 GetProcAddress(hAdvapi32, "SystemFunction036"); |
|
8395 console_printf("P_RtlGenRandom: %x\n", P_RtlGenRandom); |
|
8396 if (P_RtlGenRandom == 0) { |
|
8397 goto error; |
|
8398 } |
|
8399 } |
|
8400 } |
|
8401 if ((*P_RtlGenRandom)(__buffer, __bufferSize)) { |
|
8402 RETURN (buffer); |
|
8403 } |
|
8404 error: ; |
|
8405 %}. |
|
8406 self primitiveFailed. |
|
8407 ^ nil |
|
8408 |
|
8409 " |
|
8410 Win32OperatingSystem |
|
8411 primRtlGenRandomInto:(ByteArray new:4) |
8361 " |
8412 " |
8362 ! |
8413 ! |
8363 |
8414 |
8364 setEnvironment:aStringOrSymbol to:newValueString |
8415 setEnvironment:aStringOrSymbol to:newValueString |
8365 "set an environment variable" |
8416 "set an environment variable" |
16444 ! ! |
16495 ! ! |
16445 |
16496 |
16446 !Win32OperatingSystem class methodsFor:'documentation'! |
16497 !Win32OperatingSystem class methodsFor:'documentation'! |
16447 |
16498 |
16448 version |
16499 version |
16449 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.390 2010-02-26 10:08:48 stefan Exp $' |
16500 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.391 2010-03-08 12:43:38 cg Exp $' |
16450 ! |
16501 ! |
16451 |
16502 |
16452 version_CVS |
16503 version_CVS |
16453 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.390 2010-02-26 10:08:48 stefan Exp $' |
16504 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.391 2010-03-08 12:43:38 cg Exp $' |
16454 ! ! |
16505 ! ! |
16455 |
16506 |
16456 Win32OperatingSystem initialize! |
16507 Win32OperatingSystem initialize! |
16457 Win32OperatingSystem::PerformanceData initialize! |
16508 Win32OperatingSystem::PerformanceData initialize! |
16458 Win32OperatingSystem::RegistryEntry initialize! |
16509 Win32OperatingSystem::RegistryEntry initialize! |