1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * Simple Application which calls the DllRegisterServer or DllUnregisterServer functions
4 * of the XMerge ActiveSync plugin.
13 typedef HRESULT (STDAPICALLTYPE
*DLLREGISTERSERVER
)(void);
14 typedef HRESULT (STDAPICALLTYPE
*DLLUNREGISTERSERVER
)(void);
16 int main(int argc
, char* argv
[])
18 BOOL bUninstall
= FALSE
;
21 if (argc
< 2 || argc
> 3)
23 printf("\nUsage: regutil [/u] <Full Path of XMergeSync.dll>\n\n");
30 if (strcmp("/u", argv
[1]))
32 printf("\nUnrecognised option: %s\n", argv
[1]);
41 // Dynamically load the library
42 HMODULE hmXMDll
= LoadLibrary(argv
[nPathIndex
]);
46 printf("\nUnable to load the library %s\n", argv
[nPathIndex
]);
51 // Get an offset to the either the DllRegisterServer or DllUnregisterServer functions
54 printf("\nRegistering %s ... ", argv
[nPathIndex
]);
56 DLLREGISTERSERVER DllRegisterServer
= (DLLREGISTERSERVER
)GetProcAddress(hmXMDll
, "DllRegisterServer");
58 if (DllRegisterServer
== NULL
)
60 printf("failed.\n\nDllRegisterServer is not present in library.\n");
64 // Now call the procedure ...
65 HRESULT regResult
= DllRegisterServer() ;
67 if (regResult
!= S_OK
)
75 printf("\nUnregistering %s ... ", argv
[nPathIndex
]);
77 DLLUNREGISTERSERVER DllUnregisterServer
= (DLLUNREGISTERSERVER
)GetProcAddress(hmXMDll
, "DllUnregisterServer");
79 if (DllUnregisterServer
== NULL
)
81 printf("failed.\n\nDllUnregisterServer is not present in library.\n");
85 // Now call the procedure ...
86 HRESULT regResult
= DllUnregisterServer() ;
88 if (regResult
!= S_OK
)
100 FreeLibrary(hmXMDll
);
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */