Index: cfgmgr/cfgmgr.c |
— | — | @@ -24,9 +24,6 @@ |
25 | 25 | #include <stdio.h>
|
26 | 26 | #include <Windows.h>
|
27 | 27 | #include <ShellAPI.h>
|
28 | | -#ifndef LSTATUS
|
29 | | -typedef LONG LSTATUS;
|
30 | | -#endif
|
31 | 28 | #include "crc32.h"
|
32 | 29 | #include "LibSha256.h"
|
33 | 30 | #include "cfgmgr.h"
|
— | — | @@ -109,6 +106,11 @@ |
110 | 107 | DialogBox(hddraw, MAKEINTRESOURCE(IDD_COMPAT), NULL, CompatDialogCallback);
|
111 | 108 | cmdline = GetCommandLine();
|
112 | 109 | cmdline2 = (LPTSTR)malloc((_tcslen(cmdline) + 1)*sizeof(TCHAR));
|
| 110 | + if (!cmdline2)
|
| 111 | + {
|
| 112 | + MessageBox(NULL, _T("Fatal error restarting application"), _T("Out of memory"), MB_OK | MB_ICONSTOP);
|
| 113 | + ExitProcess(ERROR_NOT_ENOUGH_MEMORY);
|
| 114 | + }
|
113 | 115 | _tcscpy(cmdline2, cmdline);
|
114 | 116 | ZeroMemory(&startupinfo, sizeof(STARTUPINFO));
|
115 | 117 | startupinfo.cb = sizeof(STARTUPINFO);
|
— | — | @@ -882,7 +884,7 @@ |
883 | 885 | sha256string[256 / 4] = 0;
|
884 | 886 | _tcscat(regkey, sha256string);
|
885 | 887 | error = RegOpenKeyEx(HKEY_CURRENT_USER, regkey, 0, KEY_READ, &hKey);
|
886 | | - if (error = ERROR_SUCCESS)
|
| 888 | + if (error == ERROR_SUCCESS)
|
887 | 889 | {
|
888 | 890 | RegCloseKey(hKey);
|
889 | 891 | return TRUE;
|
— | — | @@ -902,6 +904,7 @@ |
903 | 905 | int i;
|
904 | 906 | TCHAR filename[MAX_PATH + 1];
|
905 | 907 | _tcsncpy(pathlwr, path, MAX_PATH);
|
| 908 | + pathlwr[MAX_PATH] = 0;
|
906 | 909 | for (i = _tcslen(pathlwr); (i > 0) && (pathlwr[i] != 92) && (pathlwr[i] != 47); i--);
|
907 | 910 | pathlwr[i] = 0;
|
908 | 911 | _tcslwr(pathlwr);
|
— | — | @@ -1276,6 +1279,7 @@ |
1277 | 1280 | strcat(floatformat, number);
|
1278 | 1281 | strcat(floatformat, "g");
|
1279 | 1282 | _snprintf(number, 31, floatformat, value);
|
| 1283 | + number[31] = 0;
|
1280 | 1284 | strcat(buffer, number);
|
1281 | 1285 | strcat(buffer, "\r\n");
|
1282 | 1286 | buffersize = strlen(buffer);
|
— | — | @@ -1457,7 +1461,7 @@ |
1458 | 1462 | {
|
1459 | 1463 | while (1)
|
1460 | 1464 | {
|
1461 | | - ReadFile(file2, buffer, 512, &bytesread, NULL);
|
| 1465 | + if(!ReadFile(file2, buffer, 512, &bytesread, NULL)) break;
|
1462 | 1466 | if (!bytesread) break;
|
1463 | 1467 | Sha256Update(&sha_context, buffer, bytesread);
|
1464 | 1468 | if (bytesread < 512) break;
|
— | — | @@ -1564,7 +1568,7 @@ |
1565 | 1569 | HMODULE hSHCore = NULL;
|
1566 | 1570 | HMODULE hUser32 = NULL;
|
1567 | 1571 | HRESULT(WINAPI *_SetProcessDpiAwareness)(DWORD value);
|
1568 | | - BOOL(WINAPI *_SetProcessDpiAwarenessContext)(HANDLE value);
|
| 1572 | + BOOL(WINAPI *_SetProcessDpiAwarenessContext)(HANDLE value) = NULL;
|
1569 | 1573 | BOOL(WINAPI *_SetProcessDPIAware)();
|
1570 | 1574 | GetModuleFileName(NULL, filename, MAX_PATH);
|
1571 | 1575 | _tcscpy(regkey, regkeybase);
|
Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -4267,7 +4267,7 @@ |
4268 | 4268 | icc.dwSize = sizeof(icc);
|
4269 | 4269 | icc.dwICC = ICC_WIN95_CLASSES;
|
4270 | 4270 | comctl32 = LoadLibrary(_T("comctl32.dll"));
|
4271 | | - iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
| 4271 | + if (comctl32) iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
4272 | 4272 | if(iccex) iccex(&icc);
|
4273 | 4273 | else InitCommonControls();
|
4274 | 4274 | hinstance = hInstance;
|
Index: dxglcfg/dxgltest.cpp |
— | — | @@ -152,10 +152,10 @@ |
153 | 153 | case WM_INITDIALOG:
|
154 | 154 | if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
|
155 | 155 | mod_ddraw = LoadLibrary(_T("ddraw.dll"));
|
156 | | - IsDXGLDDraw = GetProcAddress(mod_ddraw,"IsDXGLDDraw");
|
| 156 | + if(mod_ddraw) IsDXGLDDraw = GetProcAddress(mod_ddraw,"IsDXGLDDraw");
|
157 | 157 | if(IsDXGLDDraw) SetWindowText(GetDlgItem(hWnd,IDC_DDTYPE),_T("DXGL"));
|
158 | 158 | else SetWindowText(GetDlgItem(hWnd,IDC_DDTYPE),_T("System"));
|
159 | | - FreeLibrary(mod_ddraw);
|
| 159 | + if(mod_ddraw) FreeLibrary(mod_ddraw);
|
160 | 160 | GetFileVersion(ver,dllnames[0]);
|
161 | 161 | SetWindowText(GetDlgItem(hWnd,dllboxes[0]),ver.c_str());
|
162 | 162 | if(!IsDXGLDDraw)
|
Index: dxglcfg-old/dxglcfg-old.c |
— | — | @@ -1884,7 +1884,7 @@ |
1885 | 1885 | icc.dwSize = sizeof(icc);
|
1886 | 1886 | icc.dwICC = ICC_WIN95_CLASSES;
|
1887 | 1887 | comctl32 = LoadLibrary(_T("comctl32.dll"));
|
1888 | | - iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
| 1888 | + if(comctl32) iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
1889 | 1889 | if(iccex) iccex(&icc);
|
1890 | 1890 | else InitCommonControls();
|
1891 | 1891 | hinstance = hInstance;
|