msisip: Implement DllRegisterServer/DllUnregisterServer.
[wine/gsoc_dplay.git] / dlls / msisip / main.c
blob04ba0336b65b0d7ab6d214dd2e34cad95b0c5b51
1 /*
2 * Copyright 2008 Juan Lang
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
20 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
23 #include "wincrypt.h"
24 #include "mssip.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(msisip);
29 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
31 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
33 switch (fdwReason)
35 case DLL_WINE_PREATTACH:
36 return FALSE; /* prefer native version */
37 case DLL_PROCESS_ATTACH:
38 DisableThreadLibraryCalls(hinstDLL);
39 break;
40 case DLL_PROCESS_DETACH:
41 break;
42 default:
43 break;
46 return TRUE;
49 static GUID mySubject = { 0x000c10f1, 0x0000, 0x0000,
50 { 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }};
52 /***********************************************************************
53 * DllRegisterServer (MSISIP.@)
55 HRESULT WINAPI DllRegisterServer(void)
57 static WCHAR msisip[] = { 'M','S','I','S','I','P','.','D','L','L',0 };
58 static WCHAR getSignedDataMsg[] = { 'M','s','i','S','I','P','G','e','t',
59 'S','i','g','n','e','d','D','a','t','a','M','s','g',0 };
60 static WCHAR putSignedDataMsg[] = { 'M','s','i','S','I','P','P','u','t',
61 'S','i','g','n','e','d','D','a','t','a','M','s','g',0 };
62 static WCHAR createIndirectData[] = { 'M','s','i','S','I','P',
63 'C','r','e','a','t','e','I','n','d','i','r','e','c','t','D','a','t','a',
64 0 };
65 static WCHAR verifyIndirectData[] = { 'M','s','i','S','I','P',
66 'V','e','r','i','f','y','I','n','d','i','r','e','c','t','D','a','t','a',
67 0 };
68 static WCHAR removeSignedDataMsg[] = { 'M','s','i','S','I','P','R','e','m',
69 'o','v','e','S','i','g','n','e','d','D','a','t','a','M','s','g', 0 };
70 static WCHAR isMyTypeOfFile[] = { 'M','s','i','S','I','P',
71 'I','s','M','y','T','y','p','e','O','f','F','i','l','e',0 };
73 SIP_ADD_NEWPROVIDER prov;
75 memset(&prov, 0, sizeof(prov));
76 prov.cbStruct = sizeof(prov);
77 prov.pwszDLLFileName = msisip;
78 prov.pgSubject = &mySubject;
79 prov.pwszGetFuncName = getSignedDataMsg;
80 prov.pwszPutFuncName = putSignedDataMsg;
81 prov.pwszCreateFuncName = createIndirectData;
82 prov.pwszVerifyFuncName = verifyIndirectData;
83 prov.pwszRemoveFuncName = removeSignedDataMsg;
84 prov.pwszIsFunctionNameFmt2 = isMyTypeOfFile;
85 return CryptSIPAddProvider(&prov) ? S_OK : S_FALSE;
88 /***********************************************************************
89 * DllUnregisterServer (MSISIP.@)
91 HRESULT WINAPI DllUnregisterServer(void)
93 CryptSIPRemoveProvider(&mySubject);
94 return S_OK;