Update urandom.nim for 2.0.0
It's backwards compatible with Nim < 2.0.0
This commit is contained in:
parent
8cb8720b56
commit
740deeef9d
1 changed files with 12 additions and 6 deletions
|
|
@ -12,16 +12,22 @@ when defined(windows):
|
|||
|
||||
{.push, stdcall, dynlib: "Advapi32.dll".}
|
||||
|
||||
when useWinUnicode:
|
||||
when (NimMajor, NimMinor, NimPatch) < (2, 0, 0):
|
||||
when useWinUnicode:
|
||||
proc CryptAcquireContext(
|
||||
phProv: ptr HCRYPTPROV, pszContainer: WideCString,
|
||||
pszProvider: WideCString, dwProvType: DWORD, dwFlags: DWORD
|
||||
): WINBOOL {.importc: "CryptAcquireContextW".}
|
||||
else:
|
||||
proc CryptAcquireContext(
|
||||
phProv: ptr HCRYPTPROV, pszContainer: cstring, pszProvider: cstring,
|
||||
dwProvType: DWORD, dwFlags: DWORD
|
||||
): WINBOOL {.importc: "CryptAcquireContextA".}
|
||||
else:
|
||||
proc CryptAcquireContext(
|
||||
phProv: ptr HCRYPTPROV, pszContainer: WideCString,
|
||||
pszProvider: WideCString, dwProvType: DWORD, dwFlags: DWORD
|
||||
): WINBOOL {.importc: "CryptAcquireContextW".}
|
||||
else:
|
||||
proc CryptAcquireContext(
|
||||
phProv: ptr HCRYPTPROV, pszContainer: cstring, pszProvider: cstring,
|
||||
dwProvType: DWORD, dwFlags: DWORD
|
||||
): WINBOOL {.importc: "CryptAcquireContextA".}
|
||||
|
||||
proc CryptGenRandom(
|
||||
hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: pointer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue