Index: reactos/dll/cpl/desk/desk.c =================================================================== --- reactos/dll/cpl/desk/desk.c (revision 57921) +++ reactos/dll/cpl/desk/desk.c (working copy) @@ -9,6 +9,7 @@ */ #include "desk.h" +#include #define NUM_APPLETS (1) @@ -208,7 +209,96 @@ return FALSE; } +DWORD WINAPI +InstallScreenSaverW( + IN HWND hWindow, + IN HANDLE hInstance, + IN LPCWSTR pszFile, + IN UINT nCmdShow) +{ + WCHAR pszSystemDir[MAX_PATH]; + WCHAR pszDrive[2]; + WCHAR pszPath[MAX_PATH]; + WCHAR pszFilename[MAX_PATH]; + WCHAR pszExt[MAX_PATH]; + LPWSTR pszOutName; + LPSTR pszMBFile; + UINT uCompressionType=FILE_COMPRESSION_NONE; + DWORD dwSourceSize; + DWORD dwTargetSize; + DWORD rc; + + if( !pszFile ) + { + DPRINT("InstallScreenSaver() null file\n"); + return ERROR_INVALID_PARAMETER; + } + pszMBFile = pSetupUnicodeToMultiByte(pszFile, 0); + if( !pszMBFile ) + { + DPRINT("InstallScreenSaver() null converted filename\n"); + return ERROR_INVALID_PARAMETER; + } + DPRINT("InstallScreenSaver() Installing screensaver %s\n", pszMBFile); + MyFree(pszMBFile); + + rc = SetupGetFileCompressionInfoW( pszFile, &pszOutName, &dwSourceSize, &dwTargetSize, &uCompressionType ); + if( ERROR_SUCCESS != rc ) + { + DPRINT("InstallScreenSaver() SetupGetFileCompressionInfo failed with error 0x%lx\n", rc); + return rc; + } + if( !GetSystemDirectoryW( (LPWSTR)pszSystemDir, sizeof( pszSystemDir)/sizeof(WCHAR) ) ) + { + MyFree( pszOutName ); + rc = GetLastError(); + DPRINT("InstallScreenSaver() GetSystemDirectory failed with error 0x%lx\n", rc); + return rc; + } + _wsplitpath( pszOutName, pszDrive, pszPath, pszFilename, pszExt ); + MyFree( pszOutName ); + wcscat( pszSystemDir, L"\\" ); + wcscat( pszSystemDir, pszFilename ); + wcscat( pszSystemDir, pszExt ); + rc = SetupDecompressOrCopyFileW( pszFile, pszSystemDir, &uCompressionType ); + pszMBFile = pSetupUnicodeToMultiByte(pszSystemDir, 0); + if( !pszMBFile ) + { + DPRINT("InstallScreenSaver() null converted destination filename\n"); + return ERROR_INVALID_PARAMETER; + } + DPRINT("InstallScreenSaver() Copying to %s, compression type %d return 0x%lx\n", pszMBFile, uCompressionType, rc); + MyFree(pszMBFile); + return rc; +} +DWORD WINAPI +InstallScreenSaverA( + IN HWND hWindow, + IN HANDLE hInstance, + IN LPCSTR pszFile, + IN UINT nCmdShow) +{ + DWORD rc; + LPWSTR lpwString; + + if( !pszFile ) + { + DPRINT("InstallScreenSaver() null file\n"); + return ERROR_INVALID_PARAMETER; + } + DPRINT("InstallScreenSaver() Install from file %s\n", pszFile); + lpwString = pSetupMultiByteToUnicode(pszFile, 0); + if( !lpwString ) + { + DPRINT("InstallScreenSaver() not enough memory to convert string to unicode\n"); + return ERROR_NOT_ENOUGH_MEMORY; + } + rc = InstallScreenSaverW( hWindow, hInstance, lpwString, nCmdShow ); + MyFree(lpwString); + return rc; +} + BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID lpvReserved) { Index: reactos/dll/cpl/desk/desk.spec =================================================================== --- reactos/dll/cpl/desk/desk.spec (revision 57921) +++ reactos/dll/cpl/desk/desk.spec (working copy) @@ -1,3 +1,5 @@ @ stdcall CPlApplet(ptr long ptr ptr) @ stdcall DisplayClassInstaller(long ptr ptr) -@ stdcall DisplaySaveSettings(ptr ptr) \ No newline at end of file +@ stdcall DisplaySaveSettings(ptr ptr) +@ stdcall InstallScreenSaverW(long long ptr long) +@ stdcall InstallScreenSaverA(long long ptr long)