diff --git a/src/winecheck/check.c b/src/winecheck/check.c index 3676d80..0d2e575 100644 --- a/src/winecheck/check.c +++ b/src/winecheck/check.c @@ -127,6 +127,7 @@ struct TTF_NameRecord char clsName[] = "Systemcheck"; +bool verbose = false; LRESULT CALLBACK wndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { @@ -276,9 +277,14 @@ bool checkFontFile(const char *pattern, const char *name, const char *path) char fontFamily[256]; ULONG fontFamilyLength; + if (verbose) printf("Trying to open font file: %s\n", path); + file = fopen(path, "rb"); if (!file) + { + if (verbose) printf("Failed to open file\n"); return false; + } READ_SAFE(file, &directory, sizeof(directory)); @@ -320,8 +326,14 @@ bool checkFontFile(const char *pattern, const char *name, const char *path) fontFamily[l] = 0; } + if (verbose) printf("Checking name in file (%s) against pattern %s\n", fontFamily, pattern); + if (strcmp(pattern, fontFamily) == 0) + { + if (verbose) printf("Pattern matched\n"); result = true; + } + else if (verbose) printf("Pattern did not match\n"); break; } @@ -349,6 +361,8 @@ bool checkFonts() for (i = 0; i < sizeof(fonts) / sizeof(fonts[0]); i++) fonts[i].found = false; + if (verbose) printf("Trying to open registry key\n"); + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path, 0, KEY_READ, &hKey) != ERROR_SUCCESS) return false; @@ -357,14 +371,20 @@ bool checkFonts() lengthName = sizeof(fontName); index++; + if (verbose) printf("Got font %s\n", fontName); + for (i = 0; i < sizeof(fonts) / sizeof(fonts[0]); i++) { if (strstr(fontName, fonts[i].name)) { + if (verbose) printf("Font registry key %s matches %s\n", fontName, fonts[i].name); + lengthPath = sizeof(fontPath); if (RegGetValueA(hKey, NULL, fontName, RRF_RT_REG_SZ, NULL, fontPath, &lengthPath) != ERROR_SUCCESS) continue; + if (verbose) printf("Font path is %s\n", fontPath); + if (checkFontFile(fonts[i].name, fontName, fontPath)) { printf("Found %s in %s\n", fonts[i].name, fontPath); @@ -474,9 +494,19 @@ bool checkACLs() } -int main() +int main(int argc, char *argv[]) { bool test, ret = 0; + int i; + + for (i = 1; i < argc; i++) + { + if (!strcmp(argv[i], "--verbose")) + { + verbose = true; + break; + } + } #ifdef MINGW32_FALLBACK module_advapi32 = LoadLibraryA("advapi32.dll");