diff options
Diffstat (limited to 'src/Common/Random.c')
-rw-r--r-- | src/Common/Random.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Common/Random.c b/src/Common/Random.c index c897e3b7..445e8f24 100644 --- a/src/Common/Random.c +++ b/src/Common/Random.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "Tcdefs.h" | 12 | #include "Tcdefs.h" |
13 | #include "Crc.h" | 13 | #include "Crc.h" |
14 | #include "Random.h" | 14 | #include "Random.h" |
15 | #include <Strsafe.h> | ||
15 | 16 | ||
16 | static unsigned __int8 buffer[RNG_POOL_SIZE]; | 17 | static unsigned __int8 buffer[RNG_POOL_SIZE]; |
17 | static unsigned char *pRandPool = NULL; | 18 | static unsigned char *pRandPool = NULL; |
@@ -576,10 +577,10 @@ BOOL SlowPoll (void) | |||
576 | char dllPath[MAX_PATH]; | 577 | char dllPath[MAX_PATH]; |
577 | if (GetSystemDirectory (dllPath, MAX_PATH)) | 578 | if (GetSystemDirectory (dllPath, MAX_PATH)) |
578 | { | 579 | { |
579 | strcat(dllPath, "\\NETAPI32.DLL"); | 580 | StringCbCatA(dllPath, sizeof(dllPath), "\\NETAPI32.DLL"); |
580 | } | 581 | } |
581 | else | 582 | else |
582 | strcpy(dllPath, "C:\\Windows\\System32\\NETAPI32.DLL"); | 583 | StringCbCopyA(dllPath, sizeof(dllPath), "C:\\Windows\\System32\\NETAPI32.DLL"); |
583 | 584 | ||
584 | hNetAPI32 = LoadLibrary (dllPath); | 585 | hNetAPI32 = LoadLibrary (dllPath); |
585 | if (hNetAPI32 != NULL) | 586 | if (hNetAPI32 != NULL) |
@@ -630,7 +631,7 @@ BOOL SlowPoll (void) | |||
630 | char szDevice[24]; | 631 | char szDevice[24]; |
631 | 632 | ||
632 | /* Check whether we can access this device */ | 633 | /* Check whether we can access this device */ |
633 | sprintf (szDevice, "\\\\.\\PhysicalDrive%d", nDrive); | 634 | StringCbPrintfA (szDevice, sizeof(szDevice), "\\\\.\\PhysicalDrive%d", nDrive); |
634 | hDevice = CreateFile (szDevice, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, | 635 | hDevice = CreateFile (szDevice, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, |
635 | NULL, OPEN_EXISTING, 0, NULL); | 636 | NULL, OPEN_EXISTING, 0, NULL); |
636 | if (hDevice == INVALID_HANDLE_VALUE) | 637 | if (hDevice == INVALID_HANDLE_VALUE) |