[DEVMGR]
[reactos.git] / reactos / dll / win32 / devmgr / api.cpp
1 /*
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS devmgr.dll
5 * FILE: dll/win32/devmgr/api.cpp
6 * PURPOSE: devmgr.dll interface
7 * PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
8 * Ged Murphy (gedmurphy@reactos.org)
9 * NOTES:
10 * Some helpful resources:
11 * http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;815320
12 * http://www.jsiinc.com/SUBO/tip7400/rh7482.htm
13 * http://www.jsiinc.com/SUBM/tip6400/rh6490.htm
14 *
15 * UPDATE HISTORY:
16 * 04-04-2004 Created
17 */
18
19 #include "precomp.h"
20 #include <devmgr/devmgr.h>
21 #include "devmgmt/MainWindow.h"
22 #include "properties/properties.h"
23
24 HINSTANCE hDllInstance = NULL;
25
26
27
28 /***************************************************************************
29 * NAME EXPORTED
30 * DeviceAdvancedPropertiesW
31 *
32 * DESCRIPTION
33 * Invokes the device properties dialog, this version may add some property pages
34 * for some devices
35 *
36 * ARGUMENTS
37 * hWndParent: Handle to the parent window
38 * lpMachineName: Machine Name, NULL is the local machine
39 * lpDeviceID: Specifies the device whose properties are to be shown
40 *
41 * RETURN VALUE
42 * Always returns -1, a call to GetLastError returns 0 if successful
43 *
44 * @implemented
45 */
46 INT_PTR
47 WINAPI
48 DeviceAdvancedPropertiesW(IN HWND hWndParent OPTIONAL,
49 IN LPCWSTR lpMachineName OPTIONAL,
50 IN LPCWSTR lpDeviceID)
51 {
52 HDEVINFO hDevInfo;
53 SP_DEVINFO_DATA DevInfoData;
54 HINSTANCE hComCtl32;
55 INT_PTR Ret = -1;
56
57 if (lpDeviceID == NULL)
58 {
59 SetLastError(ERROR_INVALID_PARAMETER);
60 return FALSE;
61 }
62
63 /* dynamically load comctl32 */
64 hComCtl32 = LoadAndInitComctl32();
65 if (hComCtl32 != NULL)
66 {
67 hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
68 hWndParent,
69 lpMachineName,
70 NULL);
71 if (hDevInfo != INVALID_HANDLE_VALUE)
72 {
73 DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
74 if (SetupDiOpenDeviceInfo(hDevInfo,
75 lpDeviceID,
76 hWndParent,
77 0,
78 &DevInfoData))
79 {
80 Ret = DisplayDeviceAdvancedProperties(hWndParent,
81 lpDeviceID,
82 hDevInfo,
83 &DevInfoData,
84 hComCtl32,
85 lpMachineName,
86 0);
87 }
88
89 SetupDiDestroyDeviceInfoList(hDevInfo);
90 }
91
92 FreeLibrary(hComCtl32);
93 }
94
95 return Ret;
96 }
97
98
99 /***************************************************************************
100 * NAME EXPORTED
101 * DeviceAdvancedPropertiesA
102 *
103 * DESCRIPTION
104 * Invokes the device properties dialog, this version may add some property pages
105 * for some devices
106 *
107 * ARGUMENTS
108 * hWndParent: Handle to the parent window
109 * lpMachineName: Machine Name, NULL is the local machine
110 * lpDeviceID: Specifies the device whose properties are to be shown
111 *
112 * RETURN VALUE
113 * Always returns -1, a call to GetLastError returns 0 if successful
114 *
115 * @implemented
116 */
117 INT_PTR
118 WINAPI
119 DeviceAdvancedPropertiesA(IN HWND hWndParent OPTIONAL,
120 IN LPCSTR lpMachineName OPTIONAL,
121 IN LPCSTR lpDeviceID)
122 {
123 LPWSTR lpMachineNameW = NULL;
124 LPWSTR lpDeviceIDW = NULL;
125 INT_PTR Ret = -1;
126
127 if (lpMachineName != NULL)
128 {
129 if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
130 CP_ACP)))
131 {
132 goto Cleanup;
133 }
134 }
135 if (lpDeviceID != NULL)
136 {
137 if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
138 CP_ACP)))
139 {
140 goto Cleanup;
141 }
142 }
143
144 Ret = DeviceAdvancedPropertiesW(hWndParent,
145 lpMachineNameW,
146 lpDeviceIDW);
147
148 Cleanup:
149 if (lpMachineNameW != NULL)
150 {
151 HeapFree(GetProcessHeap(),
152 0,
153 lpMachineNameW);
154 }
155 if (lpDeviceIDW != NULL)
156 {
157 HeapFree(GetProcessHeap(),
158 0,
159 lpDeviceIDW);
160 }
161
162 return Ret;
163 }
164
165
166 /***************************************************************************
167 * NAME EXPORTED
168 * DevicePropertiesExA
169 *
170 * DESCRIPTION
171 * Invokes the extended device properties dialog
172 *
173 * ARGUMENTS
174 * hWndParent: Handle to the parent window
175 * lpMachineName: Machine Name, NULL is the local machine
176 * lpDeviceID: Specifies the device whose properties are to be shown, optional if
177 * bShowDevMgr is nonzero
178 * dwFlags: This parameter can be a combination of the following flags:
179 * * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
180 * the default device status action button
181 * to be clicked (Troubleshoot, Enable
182 * Device, etc)
183 * bShowDevMgr: If non-zero it displays the device manager instead of
184 * the advanced device property dialog
185 *
186 * RETURN VALUE
187 * 1: if bShowDevMgr is non-zero and no error occured
188 * -1: a call to GetLastError returns 0 if successful
189 *
190 * @implemented
191 */
192 INT_PTR
193 WINAPI
194 DevicePropertiesExA(IN HWND hWndParent OPTIONAL,
195 IN LPCSTR lpMachineName OPTIONAL,
196 IN LPCSTR lpDeviceID OPTIONAL,
197 IN DWORD dwFlags OPTIONAL,
198 IN BOOL bShowDevMgr)
199 {
200 LPWSTR lpMachineNameW = NULL;
201 LPWSTR lpDeviceIDW = NULL;
202 INT_PTR Ret = -1;
203
204 if (lpMachineName != NULL)
205 {
206 if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
207 CP_ACP)))
208 {
209 goto Cleanup;
210 }
211 }
212 if (lpDeviceID != NULL)
213 {
214 if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
215 CP_ACP)))
216 {
217 goto Cleanup;
218 }
219 }
220
221 Ret = DevicePropertiesExW(hWndParent,
222 lpMachineNameW,
223 lpDeviceIDW,
224 dwFlags,
225 bShowDevMgr);
226
227 Cleanup:
228 if (lpMachineNameW != NULL)
229 {
230 HeapFree(GetProcessHeap(),
231 0,
232 lpMachineNameW);
233 }
234 if (lpDeviceIDW != NULL)
235 {
236 HeapFree(GetProcessHeap(),
237 0,
238 lpDeviceIDW);
239 }
240
241 return Ret;
242 }
243
244
245 /***************************************************************************
246 * NAME EXPORTED
247 * DevicePropertiesExW
248 *
249 * DESCRIPTION
250 * Invokes the extended device properties dialog
251 *
252 * ARGUMENTS
253 * hWndParent: Handle to the parent window
254 * lpMachineName: Machine Name, NULL is the local machine
255 * lpDeviceID: Specifies the device whose properties are to be shown, optional if
256 * bShowDevMgr is nonzero
257 * dwFlags: This parameter can be a combination of the following flags:
258 * * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
259 * the default device status action button
260 * to be clicked (Troubleshoot, Enable
261 * Device, etc)
262 * bShowDevMgr: If non-zero it displays the device manager instead of
263 * the advanced device property dialog
264 *
265 * RETURN VALUE
266 * 1: if bShowDevMgr is non-zero and no error occured
267 * -1: a call to GetLastError returns 0 if successful
268 *
269 * @implemented
270 */
271 INT_PTR
272 WINAPI
273 DevicePropertiesExW(IN HWND hWndParent OPTIONAL,
274 IN LPCWSTR lpMachineName OPTIONAL,
275 IN LPCWSTR lpDeviceID OPTIONAL,
276 IN DWORD dwFlags OPTIONAL,
277 IN BOOL bShowDevMgr)
278 {
279 INT_PTR Ret = -1;
280
281 if (dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION))
282 {
283 FIXME("DevPropertiesExW: Invalid flags: 0x%x\n",
284 dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION));
285 SetLastError(ERROR_INVALID_FLAGS);
286 return -1;
287 }
288
289 if (bShowDevMgr)
290 {
291 FIXME("DevPropertiesExW doesn't support bShowDevMgr!\n");
292 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
293 }
294 else
295 {
296 HDEVINFO hDevInfo;
297 SP_DEVINFO_DATA DevInfoData;
298 HINSTANCE hComCtl32;
299
300 if (lpDeviceID == NULL)
301 {
302 SetLastError(ERROR_INVALID_PARAMETER);
303 return -1;
304 }
305
306 /* dynamically load comctl32 */
307 hComCtl32 = LoadAndInitComctl32();
308 if (hComCtl32 != NULL)
309 {
310 hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
311 hWndParent,
312 lpMachineName,
313 NULL);
314 if (hDevInfo != INVALID_HANDLE_VALUE)
315 {
316 DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
317 if (SetupDiOpenDeviceInfo(hDevInfo,
318 lpDeviceID,
319 hWndParent,
320 0,
321 &DevInfoData))
322 {
323 Ret = DisplayDeviceAdvancedProperties(hWndParent,
324 lpDeviceID,
325 hDevInfo,
326 &DevInfoData,
327 hComCtl32,
328 lpMachineName,
329 dwFlags);
330 }
331
332 SetupDiDestroyDeviceInfoList(hDevInfo);
333 }
334
335 FreeLibrary(hComCtl32);
336 }
337 }
338
339 return Ret;
340 }
341
342
343 /***************************************************************************
344 * NAME EXPORTED
345 * DevicePropertiesA
346 *
347 * DESCRIPTION
348 * Invokes the device properties dialog directly
349 *
350 * ARGUMENTS
351 * hWndParent: Handle to the parent window
352 * lpMachineName: Machine Name, NULL is the local machine
353 * lpDeviceID: Specifies the device whose properties are to be shown
354 * bShowDevMgr: If non-zero it displays the device manager instead of
355 * the device property dialog
356 *
357 * RETURN VALUE
358 * >=0: if no errors occured
359 * -1: if errors occured
360 *
361 * REVISIONS
362 *
363 * @implemented
364 */
365 int
366 WINAPI
367 DevicePropertiesA(HWND hWndParent,
368 LPCSTR lpMachineName,
369 LPCSTR lpDeviceID,
370 BOOL bShowDevMgr)
371 {
372 return DevicePropertiesExA(hWndParent,
373 lpMachineName,
374 lpDeviceID,
375 DPF_EXTENDED,
376 bShowDevMgr);
377 }
378
379
380 /***************************************************************************
381 * NAME EXPORTED
382 * DevicePropertiesW
383 *
384 * DESCRIPTION
385 * Invokes the device properties dialog directly
386 *
387 * ARGUMENTS
388 * hWndParent: Handle to the parent window
389 * lpMachineName: Machine Name, NULL is the local machine
390 * lpDeviceID: Specifies the device whose properties are to be shown
391 * bShowDevMgr: If non-zero it displays the device manager instead of
392 * the device property dialog
393 *
394 * RETURN VALUE
395 * >=0: if no errors occured
396 * -1: if errors occured
397 *
398 * REVISIONS
399 *
400 * @implemented
401 */
402 int
403 WINAPI
404 DevicePropertiesW(HWND hWndParent,
405 LPCWSTR lpMachineName,
406 LPCWSTR lpDeviceID,
407 BOOL bShowDevMgr)
408 {
409 return DevicePropertiesExW(hWndParent,
410 lpMachineName,
411 lpDeviceID,
412 DPF_EXTENDED,
413 bShowDevMgr);
414 }
415
416
417 /***************************************************************************
418 * NAME EXPORTED
419 * DeviceProperties_RunDLLA
420 *
421 * DESCRIPTION
422 * Invokes the device properties dialog
423 *
424 * ARGUMENTS
425 * hWndParent: Handle to the parent window
426 * hInst: Handle to the application instance
427 * lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
428 * also see NOTEs
429 * nCmdShow: Specifies how the window should be shown
430 *
431 * RETURN VALUE
432 *
433 * REVISIONS
434 *
435 * NOTE
436 * - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
437 * (/MachineName is optional). This function only parses this string and eventually
438 * calls DeviceProperties().
439 *
440 * @implemented
441 */
442 VOID
443 WINAPI
444 DeviceProperties_RunDLLA(HWND hWndParent,
445 HINSTANCE hInst,
446 LPCSTR lpDeviceCmd,
447 int nCmdShow)
448 {
449 LPWSTR lpDeviceCmdW = NULL;
450
451 if (lpDeviceCmd != NULL)
452 {
453 if ((lpDeviceCmdW = ConvertMultiByteToUnicode(lpDeviceCmd,
454 CP_ACP)))
455 {
456 DeviceProperties_RunDLLW(hWndParent,
457 hInst,
458 lpDeviceCmdW,
459 nCmdShow);
460 }
461 }
462
463 if (lpDeviceCmdW != NULL)
464 {
465 HeapFree(GetProcessHeap(),
466 0,
467 lpDeviceCmdW);
468 }
469 }
470
471
472 /***************************************************************************
473 * NAME EXPORTED
474 * DeviceProperties_RunDLLW
475 *
476 * DESCRIPTION
477 * Invokes the device properties dialog
478 *
479 * ARGUMENTS
480 * hWndParent: Handle to the parent window
481 * hInst: Handle to the application instance
482 * lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
483 * also see NOTEs
484 * nCmdShow: Specifies how the window should be shown
485 *
486 * RETURN VALUE
487 *
488 * REVISIONS
489 *
490 * NOTE
491 * - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
492 * (/MachineName is optional). This function only parses this string and eventually
493 * calls DeviceProperties().
494 *
495 * @implemented
496 */
497 VOID
498 WINAPI
499 DeviceProperties_RunDLLW(HWND hWndParent,
500 HINSTANCE hInst,
501 LPCWSTR lpDeviceCmd,
502 int nCmdShow)
503 {
504 WCHAR szDeviceID[MAX_DEVICE_ID_LEN + 1];
505 WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH + 1];
506 LPWSTR lpString = (LPWSTR)lpDeviceCmd;
507
508 if (!GetDeviceAndComputerName(lpString,
509 szDeviceID,
510 szMachineName))
511 {
512 ERR("DeviceProperties_RunDLLW DeviceID: %S, MachineName: %S\n", szDeviceID, szMachineName);
513 return;
514 }
515
516 DevicePropertiesW(hWndParent,
517 szMachineName,
518 szDeviceID,
519 FALSE);
520 }
521
522
523
524 /***************************************************************************
525 * NAME EXPORTED
526 * DeviceManager_ExecuteA
527 *
528 * DESCRIPTION
529 * Starts the Device Manager
530 *
531 * ARGUMENTS
532 * hWndParent: Handle to the parent window
533 * hInst: Handle to the application instance
534 * lpMachineName: Machine Name, NULL is the local machine
535 * nCmdShow: Specifies how the window should be shown
536 *
537 * RETURN VALUE
538 * TRUE: if no errors occured
539 * FALSE: if the device manager could not be executed
540 *
541 * REVISIONS
542 *
543 * NOTE
544 * - Win runs the device manager in a separate process, so hWndParent is somehow
545 * obsolete.
546 *
547 * @implemented
548 */
549 BOOL
550 WINAPI
551 DeviceManager_ExecuteA(HWND hWndParent,
552 HINSTANCE hInst,
553 LPCSTR lpMachineName,
554 int nCmdShow)
555 {
556 LPWSTR lpMachineNameW = NULL;
557 BOOL Ret;
558
559 if (lpMachineName != NULL)
560 {
561 if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
562 CP_ACP)))
563 {
564 return FALSE;
565 }
566 }
567
568 Ret = DeviceManager_ExecuteW(hWndParent,
569 hInst,
570 lpMachineNameW,
571 nCmdShow);
572
573 if (lpMachineNameW != NULL)
574 {
575 HeapFree(GetProcessHeap(),
576 0,
577 lpMachineNameW);
578 }
579
580
581 return Ret;
582 }
583
584
585 /***************************************************************************
586 * NAME EXPORTED
587 * DeviceManager_ExecuteW
588 *
589 * DESCRIPTION
590 * Starts the Device Manager
591 *
592 * ARGUMENTS
593 * hWndParent: Handle to the parent window
594 * hInst: Handle to the application instance
595 * lpMachineName: Machine Name, NULL is the local machine
596 * nCmdShow: Specifies how the window should be shown
597 *
598 * RETURN VALUE
599 * TRUE: if no errors occured
600 * FALSE: if the device manager could not be executed
601 *
602 * REVISIONS
603 *
604 * NOTE
605 * - Win runs the device manager in a separate process, so hWndParent is somehow
606 * obsolete.
607 *
608 * @implemented
609 */
610 BOOL
611 WINAPI
612 DeviceManager_ExecuteW(HWND hWndParent,
613 HINSTANCE hInst,
614 LPCWSTR lpMachineName,
615 int nCmdShow)
616 {
617 // FIXME: Call mmc with devmgmt.msc
618
619 CDeviceManager DevMgr;
620 return DevMgr.Create(hWndParent, hInst, lpMachineName, nCmdShow);
621 }
622
623
624 /***************************************************************************
625 * NAME EXPORTED
626 * DeviceProblemWizard_RunDLLA
627 *
628 * DESCRIPTION
629 * Calls the device problem wizard
630 *
631 * ARGUMENTS
632 * hWndParent: Handle to the parent window
633 * hInst: Handle to the application instance
634 * lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
635 * also see NOTEs
636 * nCmdShow: Specifies how the window should be shown
637 *
638 * RETURN VALUE
639 *
640 * REVISIONS
641 *
642 * NOTE
643 * - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
644 * a typo so we additionally export an alias function
645 * - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
646 * (/MachineName is optional). This function only parses this string and eventually
647 * calls DeviceProperties().
648 *
649 * @unimplemented
650 */
651 VOID
652 WINAPI
653 DeviceProblemWizard_RunDLLA(HWND hWndParent,
654 HINSTANCE hInst,
655 LPCSTR lpDeviceCmd,
656 int nCmdShow)
657 {
658 UNIMPLEMENTED;
659 }
660
661
662 /***************************************************************************
663 * NAME EXPORTED
664 * DeviceProblemWizard_RunDLLW
665 *
666 * DESCRIPTION
667 * Calls the device problem wizard
668 *
669 * ARGUMENTS
670 * hWndParent: Handle to the parent window
671 * hInst: Handle to the application instance
672 * lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
673 * also see NOTEs
674 * nCmdShow: Specifies how the window should be shown
675 *
676 * RETURN VALUE
677 *
678 * REVISIONS
679 *
680 * NOTE
681 * - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
682 * a typo so we additionally export an alias function
683 * - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
684 * (/MachineName is optional). This function only parses this string and eventually
685 * calls DeviceProperties().
686 *
687 * @unimplemented
688 */
689 VOID
690 WINAPI
691 DeviceProblemWizard_RunDLLW(HWND hWndParent,
692 HINSTANCE hInst,
693 LPCWSTR lpDeviceCmd,
694 int nCmdShow)
695 {
696 UNIMPLEMENTED;
697 }
698
699
700 /***************************************************************************
701 * NAME EXPORTED
702 * DeviceManagerPrintA
703 *
704 * DESCRIPTION
705 * Calls the device problem wizard
706 *
707 * ARGUMENTS
708 * lpMachineName: Machine Name, NULL is the local machine
709 * lpPrinter: Filename of the printer where it should be printed on
710 * nPrintMode: Specifies what kind of information is to be printed
711 * DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
712 * uNumberOfGuids, Guids are ignored
713 * DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
714 * DEV_PRINT_ALL: Prints an abstract of system information and all
715 * system devices
716 * uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
717 * nPrintMode is DEV_PRINT_SELECTED
718 * lpGuids: Array of device guids, this parameter is ignored unless
719 * nPrintMode is DEV_PRINT_SELECTED
720 *
721 * RETURN VALUE
722 * TRUE: if no errors occured
723 * FALSE: if errors occured
724 *
725 * REVISIONS
726 *
727 * NOTE
728 *
729 * @unimplemented
730 */
731 BOOL
732 WINAPI
733 DeviceManagerPrintA(LPCSTR lpMachineName,
734 LPCSTR lpPrinter,
735 int nPrintMode,
736 UINT uNumberOfGuids,
737 LPGUID lpGuids)
738 {
739 UNIMPLEMENTED;
740 return FALSE;
741 }
742
743
744 /***************************************************************************
745 * NAME EXPORTED
746 * DeviceManagerPrintW
747 *
748 * DESCRIPTION
749 * Calls the device problem wizard
750 *
751 * ARGUMENTS
752 * lpMachineName: Machine Name, NULL is the local machine
753 * lpPrinter: Filename of the printer where it should be printed on
754 * nPrintMode: Specifies what kind of information is to be printed
755 * DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
756 * uNumberOfGuids, Guids are ignored
757 * DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
758 * DEV_PRINT_ALL: Prints an abstract of system information and all
759 * system devices
760 * uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
761 * nPrintMode is DEV_PRINT_SELECTED
762 * lpGuids: Array of device guids, this parameter is ignored unless
763 * nPrintMode is DEV_PRINT_SELECTED
764 *
765 * RETURN VALUE
766 * TRUE: if no errors occured
767 * FALSE: if errors occured
768 *
769 * REVISIONS
770 *
771 * NOTE
772 *
773 * @unimplemented
774 */
775 BOOL
776 WINAPI
777 DeviceManagerPrintW(LPCWSTR lpMachineName,
778 LPCWSTR lpPrinter,
779 int nPrintMode,
780 UINT uNumberOfGuids,
781 LPGUID lpGuids)
782 {
783 UNIMPLEMENTED;
784 return FALSE;
785 }
786
787
788 BOOL
789 WINAPI
790 DllMain(IN HINSTANCE hinstDLL,
791 IN DWORD dwReason,
792 IN LPVOID lpvReserved)
793 {
794 switch (dwReason)
795 {
796 case DLL_PROCESS_ATTACH:
797 DisableThreadLibraryCalls(hinstDLL);
798 hDllInstance = hinstDLL;
799 break;
800 }
801
802 return TRUE;
803 }
804
805 class CDevMgrUIModule : public CComModule
806 {
807 public:
808 };
809
810 CDevMgrUIModule gModule;
811
812 STDAPI DllCanUnloadNow()
813 {
814 return gModule.DllCanUnloadNow();
815 }
816
817 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
818 {
819 return gModule.DllGetClassObject(rclsid, riid, ppv);
820 }
821
822 STDAPI DllRegisterServer()
823 {
824 return gModule.DllRegisterServer(FALSE);
825 }
826
827 STDAPI DllUnregisterServer()
828 {
829 return gModule.DllUnregisterServer(FALSE);
830 }