mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 02:41:22 +00:00
[RAPPS]
- Do not write to the application directory. Welcome to Windows NT... svn path=/trunk/; revision=61669
This commit is contained in:
parent
c85b7d884c
commit
aaf0f8ce65
5 changed files with 37 additions and 15 deletions
|
@ -47,7 +47,7 @@ DeleteCurrentAppsDB(VOID)
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
WCHAR szTmp[MAX_PATH];
|
WCHAR szTmp[MAX_PATH];
|
||||||
|
|
||||||
if (!GetCurrentDirectoryW(MAX_PATH, szPath))
|
if (!GetStorageDirectory(szPath, sizeof(szPath) / sizeof(szPath[0])))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
swprintf(szCabPath, L"%s\\rappmgr.cab", szPath);
|
swprintf(szCabPath, L"%s\\rappmgr.cab", szPath);
|
||||||
|
@ -94,7 +94,7 @@ UpdateAppsDB(VOID)
|
||||||
|
|
||||||
DownloadApplicationsDB(APPLICATION_DATEBASE_URL);
|
DownloadApplicationsDB(APPLICATION_DATEBASE_URL);
|
||||||
|
|
||||||
if (!GetCurrentDirectoryW(MAX_PATH, szPath))
|
if (!GetStorageDirectory(szPath, sizeof(szPath) / sizeof(szPath[0])))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
swprintf(szCabPath, L"%s\\rappmgr.cab", szPath);
|
swprintf(szCabPath, L"%s\\rappmgr.cab", szPath);
|
||||||
|
@ -120,7 +120,7 @@ EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
|
||||||
WCHAR szLocale[4 + 1];
|
WCHAR szLocale[4 + 1];
|
||||||
APPLICATION_INFO Info;
|
APPLICATION_INFO Info;
|
||||||
|
|
||||||
if (!GetCurrentDirectoryW(MAX_PATH, szPath))
|
if (!GetStorageDirectory(szPath, sizeof(szPath) / sizeof(szPath[0])))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ ThreadFunc(LPVOID Context)
|
||||||
AppInfo->szUrlDownload[len - 1] == 'b')
|
AppInfo->szUrlDownload[len - 1] == 'b')
|
||||||
{
|
{
|
||||||
bCab = TRUE;
|
bCab = TRUE;
|
||||||
if (!GetCurrentDirectoryW(MAX_PATH, path))
|
if (!GetStorageDirectory(path, sizeof(path) / sizeof(path[0])))
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -208,6 +208,26 @@ StartProcess(LPWSTR lpPath, BOOL Wait)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
GetStorageDirectory(PWCHAR lpDirectory, DWORD cch)
|
||||||
|
{
|
||||||
|
if (cch < MAX_PATH)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!SHGetSpecialFolderPathW(NULL, lpDirectory, CSIDL_LOCAL_APPDATA, TRUE))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (FAILED(StringCchCatW(lpDirectory, cch, L"\\rapps")))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!CreateDirectoryW(lpDirectory, NULL) &&
|
||||||
|
GetLastError() != ERROR_ALREADY_EXISTS)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath)
|
ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath)
|
||||||
|
@ -266,8 +286,8 @@ InitLogs(VOID)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetCurrentDirectoryW(MAX_PATH, szPath)) return;
|
if (!GetModuleFileName(NULL, szPath, sizeof(szPath) / sizeof(szPath[0])))
|
||||||
wcscat(szPath, L"\\rapps.exe");
|
return;
|
||||||
|
|
||||||
if (RegSetValueExW(hKey,
|
if (RegSetValueExW(hKey,
|
||||||
L"EventMessageFile",
|
L"EventMessageFile",
|
||||||
|
|
|
@ -557,7 +557,7 @@ ParserOpen(LPCWSTR filename, BOOL write_access)
|
||||||
ItemsArray[i]->encoding = ENCODING_UTF8;
|
ItemsArray[i]->encoding = ENCODING_UTF8;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetCurrentDirectoryW(MAX_PATH, szDir);
|
GetStorageDirectory(szDir, sizeof(szDir) / sizeof(szDir[0]));
|
||||||
|
|
||||||
wcscpy(buffer, szDir);
|
wcscpy(buffer, szDir);
|
||||||
wcscat(buffer, wszSeparator);
|
wcscat(buffer, wszSeparator);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <richedit.h>
|
#include <richedit.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
#include <rappsmsg.h>
|
#include <rappsmsg.h>
|
||||||
|
|
||||||
|
@ -150,6 +151,7 @@ VOID CopyTextToClipboard(LPCWSTR lpszText);
|
||||||
VOID SetWelcomeText(VOID);
|
VOID SetWelcomeText(VOID);
|
||||||
VOID ShowPopupMenu(HWND hwnd, UINT MenuID);
|
VOID ShowPopupMenu(HWND hwnd, UINT MenuID);
|
||||||
BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
|
BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
|
||||||
|
BOOL GetStorageDirectory(PWCHAR lpDirectory, DWORD cch);
|
||||||
BOOL ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath);
|
BOOL ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath);
|
||||||
VOID InitLogs(VOID);
|
VOID InitLogs(VOID);
|
||||||
VOID FreeLogs(VOID);
|
VOID FreeLogs(VOID);
|
||||||
|
|
Loading…
Reference in a new issue