2 * Simple Application which calls the DllRegisterServer or DllUnregisterServer functions
3 * of the XMerge ActiveSync plugin.
12 typedef HRESULT (STDAPICALLTYPE
*DLLREGISTERSERVER
)(void);
13 typedef HRESULT (STDAPICALLTYPE
*DLLUNREGISTERSERVER
)(void);
15 int main(int argc
, char* argv
[])
17 BOOL bUninstall
= FALSE
;
20 if (argc
< 2 || argc
> 3)
22 printf("\nUsage: regutil [/u] <Full Path of XMergeSync.dll>\n\n");
29 if (strcmp("/u", argv
[1]))
31 printf("\nUnrecognised option: %s\n", argv
[1]);
40 // Dynamically load the library
41 HMODULE hmXMDll
= LoadLibrary(argv
[nPathIndex
]);
45 printf("\nUnable to load the library %s\n", argv
[nPathIndex
]);
50 // Get an offset to the either the DllRegisterServer or DllUnregisterServer functions
53 printf("\nRegistering %s ... ", argv
[nPathIndex
]);
55 DLLREGISTERSERVER DllRegisterServer
= (DLLREGISTERSERVER
)GetProcAddress(hmXMDll
, "DllRegisterServer");
57 if (DllRegisterServer
== NULL
)
59 printf("failed.\n\nDllRegisterServer is not present in library.\n");
63 // Now call the procedure ...
64 HRESULT regResult
= DllRegisterServer() ;
66 if (regResult
!= S_OK
)
74 printf("\nUnregistering %s ... ", argv
[nPathIndex
]);
76 DLLUNREGISTERSERVER DllUnregisterServer
= (DLLUNREGISTERSERVER
)GetProcAddress(hmXMDll
, "DllUnregisterServer");
78 if (DllUnregisterServer
== NULL
)
80 printf("failed.\n\nDllUnregisterServer is not present in library.\n");
84 // Now call the procedure ...
85 HRESULT regResult
= DllUnregisterServer() ;
87 if (regResult
!= S_OK
)