initialize COM on demand only
Modified: trunk/reactos/subsys/system/regedit/framewnd.c
Modified: trunk/reactos/subsys/system/regedit/main.c
_____
Modified: trunk/reactos/subsys/system/regedit/framewnd.c
--- trunk/reactos/subsys/system/regedit/framewnd.c 2005-09-30
22:17:58 UTC (rev 18180)
+++ trunk/reactos/subsys/system/regedit/framewnd.c 2005-09-30
23:32:24 UTC (rev 18181)
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <shellapi.h>
#include <objsel.h>
+#include <objbase.h>
#include "main.h"
#include "regproc.h"
@@ -679,20 +680,26 @@
IDsObjectPicker *ObjectPicker;
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
HRESULT hRet;
-
- hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
+
+ hRet = CoInitialize(NULL);
if (SUCCEEDED(hRet))
{
- hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker,
- hWnd,
- szComputerName,
-
sizeof(szComputerName) / sizeof(szComputerName[0]));
- if (hRet == S_OK)
+ hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
+ if (SUCCEEDED(hRet))
{
- /* FIXME - connect to the registry */
+ hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker,
+ hWnd,
+ szComputerName,
+
sizeof(szComputerName) / sizeof(szComputerName[0]));
+ if (hRet == S_OK)
+ {
+ /* FIXME - connect to the registry */
+ }
+
+ FreeObjectPicker(ObjectPicker);
}
- FreeObjectPicker(ObjectPicker);
+ CoUninitialize();
}
return TRUE;
_____
Modified: trunk/reactos/subsys/system/regedit/main.c
--- trunk/reactos/subsys/system/regedit/main.c 2005-09-30 22:17:58 UTC
(rev 18180)
+++ trunk/reactos/subsys/system/regedit/main.c 2005-09-30 23:32:24 UTC
(rev 18181)
@@ -30,7 +30,6 @@
#include <fcntl.h>
#include <aclui.h>
#include <cguid.h>
-#include <objbase.h>
#include "main.h"
#include "hexedit.h"
@@ -190,7 +189,7 @@
{
MSG msg;
HACCEL hAccel;
- HRESULT hComInit;
+
/*
int hCrt;
FILE *hf;
@@ -223,9 +222,6 @@
return FALSE;
}
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
-
- /* initialize the COM library for the remote registry object picker
dialog */
- hComInit = CoInitialize(NULL);
/* Main message loop */
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
@@ -236,11 +232,6 @@
}
}
- if (SUCCEEDED(hComInit))
- {
- CoUninitialize();
- }
-
ExitInstance(hInstance);
return msg.wParam;
}
Show replies by date