Initialized COM.

This commit is contained in:
Pietro Gagliardi 2015-05-31 19:26:21 -04:00
parent 409407b761
commit ef1b594ef0
1 changed files with 7 additions and 3 deletions

View File

@ -16,6 +16,7 @@ struct uiInitError {
#define initErrorFormat L"error %s: %s%sGetLastError() == %I32u%s" #define initErrorFormat L"error %s: %s%sGetLastError() == %I32u%s"
#define initErrorArgs wmessage, sysmsg, beforele, le, afterle #define initErrorArgs wmessage, sysmsg, beforele, le, afterle
// TODO split for HRESULTs
static const char *loadLastError(const char *message) static const char *loadLastError(const char *message)
{ {
WCHAR *sysmsg; WCHAR *sysmsg;
@ -90,6 +91,7 @@ const char *uiInit(uiInitOptions *o)
HCURSOR hDefaultCursor; HCURSOR hDefaultCursor;
NONCLIENTMETRICSW ncm; NONCLIENTMETRICSW ncm;
INITCOMMONCONTROLSEX icc; INITCOMMONCONTROLSEX icc;
HRESULT hr;
options = *o; options = *o;
@ -144,7 +146,9 @@ const char *uiInit(uiInitOptions *o)
if (initDialogHelper(hDefaultIcon, hDefaultCursor) == 0) if (initDialogHelper(hDefaultIcon, hDefaultCursor) == 0)
return loadLastError("initializing the dialog helper"); return loadLastError("initializing the dialog helper");
// TODO initialize COM hr = CoInitialize(NULL);
if (hr != S_OK && hr != S_FALSE)
return loadLastError("initializing COM"); // TODO loadHRESULT
// TODO initialize COM security // TODO initialize COM security
// TODO (windows vista) turn off COM exception handling // TODO (windows vista) turn off COM exception handling
@ -154,11 +158,11 @@ const char *uiInit(uiInitOptions *o)
void uiUninit(void) void uiUninit(void)
{ {
uninitMenus(); uninitMenus();
// TODO uninitialize COM CoUninitialize();
// TODO uninitialize the dialog helper // TODO uninitialize the dialog helper
// TODO delete hollow brush // TODO delete hollow brush
if (SetConsoleCtrlHandler(consoleCtrlHandler, FALSE) == 0) if (SetConsoleCtrlHandler(consoleCtrlHandler, FALSE) == 0)
logLastError("unregistering console end session handler"); logLastError("error unregistering console end session handler");
uninitContainer(); uninitContainer();
if (DeleteObject(hMessageFont) == 0) if (DeleteObject(hMessageFont) == 0)
logLastError("error deleting control font in uiUninit()"); logLastError("error deleting control font in uiUninit()");