mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RAPPS] Cleanup
This commit is contained in:
parent
22e58e68aa
commit
6f9dd96dcf
3 changed files with 15 additions and 95 deletions
|
@ -3,9 +3,6 @@
|
|||
#include <windef.h>
|
||||
#include <atlstr.h>
|
||||
|
||||
#define EPOCH_DIFF 116444736000000000 //FILETIME starts from 1601-01-01 UTC, UnixTime starts from 1970-01-01
|
||||
#define RATE_DIFF 10000000
|
||||
|
||||
#ifdef _M_IX86
|
||||
#define CurrentArchitecture L"x86"
|
||||
#elif defined(_M_AMD64)
|
||||
|
@ -20,16 +17,9 @@
|
|||
#define CurrentArchitecture L"ppc"
|
||||
#endif
|
||||
|
||||
INT GetWindowWidth(HWND hwnd);
|
||||
INT GetWindowHeight(HWND hwnd);
|
||||
INT GetClientWindowWidth(HWND hwnd);
|
||||
INT GetClientWindowHeight(HWND hwnd);
|
||||
|
||||
VOID CopyTextToClipboard(LPCWSTR lpszText);
|
||||
VOID ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem);
|
||||
VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
|
||||
BOOL StartProcess(ATL::CStringW &Path, BOOL Wait);
|
||||
BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
|
||||
BOOL StartProcess(const ATL::CStringW &Path, BOOL Wait);
|
||||
BOOL GetStorageDirectory(ATL::CStringW &lpDirectory);
|
||||
|
||||
VOID InitLogs();
|
||||
|
|
|
@ -15,38 +15,6 @@ static HANDLE hLog = NULL;
|
|||
static BOOL bIsSys64ResultCached = FALSE;
|
||||
static BOOL bIsSys64Result = FALSE;
|
||||
|
||||
INT GetWindowWidth(HWND hwnd)
|
||||
{
|
||||
RECT Rect;
|
||||
|
||||
GetWindowRect(hwnd, &Rect);
|
||||
return (Rect.right - Rect.left);
|
||||
}
|
||||
|
||||
INT GetWindowHeight(HWND hwnd)
|
||||
{
|
||||
RECT Rect;
|
||||
|
||||
GetWindowRect(hwnd, &Rect);
|
||||
return (Rect.bottom - Rect.top);
|
||||
}
|
||||
|
||||
INT GetClientWindowWidth(HWND hwnd)
|
||||
{
|
||||
RECT Rect;
|
||||
|
||||
GetClientRect(hwnd, &Rect);
|
||||
return (Rect.right - Rect.left);
|
||||
}
|
||||
|
||||
INT GetClientWindowHeight(HWND hwnd)
|
||||
{
|
||||
RECT Rect;
|
||||
|
||||
GetClientRect(hwnd, &Rect);
|
||||
return (Rect.bottom - Rect.top);
|
||||
}
|
||||
|
||||
VOID CopyTextToClipboard(LPCWSTR lpszText)
|
||||
{
|
||||
if (!OpenClipboard(NULL))
|
||||
|
@ -112,18 +80,7 @@ VOID ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
|
|||
}
|
||||
}
|
||||
|
||||
VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem)
|
||||
{
|
||||
ShowPopupMenuEx(hwnd, hMainWnd, MenuID, DefaultItem);
|
||||
}
|
||||
|
||||
|
||||
BOOL StartProcess(ATL::CStringW &Path, BOOL Wait)
|
||||
{
|
||||
return StartProcess(const_cast<LPWSTR>(Path.GetString()), Wait);;
|
||||
}
|
||||
|
||||
BOOL StartProcess(LPWSTR lpPath, BOOL Wait)
|
||||
BOOL StartProcess(const ATL::CStringW& Path, BOOL Wait)
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFOW si;
|
||||
|
@ -135,7 +92,11 @@ BOOL StartProcess(LPWSTR lpPath, BOOL Wait)
|
|||
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_SHOW;
|
||||
|
||||
if (!CreateProcessW(NULL, lpPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
|
||||
// The Unicode version of CreateProcess can modify the contents of this string.
|
||||
CStringW Tmp = Path;
|
||||
BOOL fSuccess = CreateProcessW(NULL, Tmp.GetBuffer(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||
Tmp.ReleaseBuffer();
|
||||
if (!fSuccess)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -19,51 +19,20 @@ HWND hMainWnd;
|
|||
HINSTANCE hInst;
|
||||
SETTINGS_INFO SettingsInfo;
|
||||
|
||||
class CRAppsModule : public CComModule
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
BEGIN_OBJECT_MAP(ObjectMap)
|
||||
END_OBJECT_MAP()
|
||||
|
||||
CRAppsModule gModule;
|
||||
CComModule gModule;
|
||||
CAtlWinModule gWinModule;
|
||||
|
||||
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
|
||||
ULONG_PTR gdiplusToken;
|
||||
|
||||
|
||||
static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize)
|
||||
{
|
||||
if (bInitialize)
|
||||
{
|
||||
gModule.Init(ObjectMap, hInstance, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gModule.Term();
|
||||
}
|
||||
}
|
||||
|
||||
VOID InitializeGDIPlus(BOOL bInitialize)
|
||||
{
|
||||
if (bInitialize)
|
||||
{
|
||||
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gdiplus::GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
}
|
||||
|
||||
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nShowCmd)
|
||||
{
|
||||
BOOL bIsFirstLaunch;
|
||||
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
|
||||
ULONG_PTR gdiplusToken;
|
||||
|
||||
InitializeAtlModule(hInstance, TRUE);
|
||||
InitializeGDIPlus(TRUE);
|
||||
gModule.Init(ObjectMap, hInstance, NULL);
|
||||
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||
|
||||
if (GetUserDefaultUILanguage() == MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT))
|
||||
{
|
||||
|
@ -72,7 +41,7 @@ INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||
|
||||
hInst = hInstance;
|
||||
|
||||
bIsFirstLaunch = !LoadSettings(&SettingsInfo);
|
||||
BOOL bIsFirstLaunch = !LoadSettings(&SettingsInfo);
|
||||
if (bIsFirstLaunch)
|
||||
{
|
||||
FillDefaultSettings(&SettingsInfo);
|
||||
|
@ -84,8 +53,8 @@ INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||
// parse cmd-line and perform the corresponding operation
|
||||
BOOL bSuccess = ParseCmdAndExecute(GetCommandLineW(), bIsFirstLaunch, SW_SHOWNORMAL);
|
||||
|
||||
InitializeGDIPlus(FALSE);
|
||||
InitializeAtlModule(GetModuleHandle(NULL), FALSE);
|
||||
Gdiplus::GdiplusShutdown(gdiplusToken);
|
||||
gModule.Term();
|
||||
|
||||
return bSuccess ? 0 : 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue