Index: dll/win32/shimgvw/CMakeLists.txt =================================================================== --- dll/win32/shimgvw/CMakeLists.txt (revision 61269) +++ dll/win32/shimgvw/CMakeLists.txt (working copy) @@ -19,6 +19,7 @@ gdiplus msvcrt kernel32 - ntdll) + ntdll + comdlg32) add_cd_file(TARGET shimgvw DESTINATION reactos/system32 FOR all) Index: dll/win32/shimgvw/shimgvw.c =================================================================== --- dll/win32/shimgvw/shimgvw.c (revision 61269) +++ dll/win32/shimgvw/shimgvw.c (working copy) @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -69,6 +70,63 @@ } } +static void pSaveImageAs(HWND hwnd) +{ + OPENFILENAMEW sfn; + ImageCodecInfo *CodecInfo; + WCHAR szSaveFileName[MAX_PATH]; + WCHAR szFilterMask[2048]; + WCHAR Temp[200]; + GUID RawFormat; + UINT num; + UINT size; + UINT j; + UINT pos; + + ZeroMemory(szSaveFileName, sizeof(szSaveFileName)); + ZeroMemory(szFilterMask, sizeof(szFilterMask)); + ZeroMemory(&sfn, sizeof(OPENFILENAME)); + sfn.lStructSize = sizeof(OPENFILENAME); + sfn.hwndOwner = hwnd; + sfn.hInstance = hInstance; + sfn.lpstrFile = szSaveFileName; + sfn.lpstrFilter = szFilterMask; + sfn.nMaxFile = sizeof(szSaveFileName); + sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; + + GdipGetImageEncodersSize(&num, &size); + CodecInfo = (ImageCodecInfo*)(malloc(size)); + GdipGetImageEncoders(num, size, CodecInfo); + GdipGetImageRawFormat(image, &RawFormat); + + pos = 0; + + for(j = 0; j < num; ++j) + { + ZeroMemory(Temp, sizeof(Temp)); + wcscat(Temp, CodecInfo[j].FormatDescription); + wcscat(Temp, L" ("); + wcscat(Temp, CodecInfo[j].FilenameExtension); + wcscat(Temp, L")"); + wcscpy(&szFilterMask[pos], Temp); + pos = pos + wcslen(Temp) + 1; + wcscpy(&szFilterMask[pos], CodecInfo[j].FilenameExtension); + pos = pos + wcslen(CodecInfo[j].FilenameExtension) + 1; + + if (IsEqualGUID(&RawFormat, &CodecInfo[j].FormatID) == TRUE) + { + sfn.nFilterIndex = j + 1; + } + } + + if (GetSaveFileNameW(&sfn) != 0) + { + GdipSaveImageToFile(image, szSaveFileName, &CodecInfo[sfn.nFilterIndex - 1].Clsid, NULL); + } + + free(CodecInfo); +} + static VOID ImageView_DrawImage(HWND hwnd) { @@ -332,6 +390,7 @@ break; case IDC_SAVE: + pSaveImageAs(hwnd); break; case IDC_PRINT: