diff --git a/windows-snapshot-tool/bin/freeze.exe b/windows-snapshot-tool/bin/freeze.exe index 932074e..d386f61 100755 Binary files a/windows-snapshot-tool/bin/freeze.exe and b/windows-snapshot-tool/bin/freeze.exe differ diff --git a/windows-snapshot-tool/src/main.cpp b/windows-snapshot-tool/src/main.cpp index a8f0c70..e2a935c 100644 --- a/windows-snapshot-tool/src/main.cpp +++ b/windows-snapshot-tool/src/main.cpp @@ -255,8 +255,16 @@ void doScreenshot() { WCHAR path[12]; getRaspiStorage(path); - MessageBox(Hwnd, path, L"Storage path", MB_OK); - CaptureImage(Hwnd, L"file.bmp"); + if (wcslen(path) != 3) { + MessageBox(Hwnd, L"Couldn't find Raspberry USB-Storage\nSaving in current directory!", L"Failure", MB_OK); + CaptureImage(Hwnd, L"screenshot.png"); + } else { + WCHAR filename[128]; + wcsncpy(filename, path, sizeof(filename)); + wcsncpy(filename, L"screenshot.png", sizeof(filename)); + CaptureImage(Hwnd, filename); + } + } void InitNotifyIconData() @@ -274,9 +282,7 @@ void InitNotifyIconData() void getRaspiStorage(LPWSTR out) { - // GetLogicalDrives() - // for result - // if result.GetDriveType() == DRIVE_REMOVABLE + out[0] = L'\0'; out[1] = L'\0'; WCHAR myDrives[105]; WCHAR volumeName[MAX_PATH]; @@ -300,7 +306,7 @@ void getRaspiStorage(LPWSTR out) { { if (GetVolumeInformationW(drive, volumeName, ARRAYSIZE(volumeName), &serialNumber, &maxComponentLen, &fileSystemFlags, fileSystemName, ARRAYSIZE(fileSystemName))) { - if (wcscmp(volumeName, L"SCREENSHOTS")) { + if (wcscmp(L"SCREENSHOTS", volumeName)==0) { // ToDo wcsncpy(out, drive, sizeof(out)); } }