• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***
2   This file is part of PulseAudio.
3 
4   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
5 
6   PulseAudio is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as published
8   by the Free Software Foundation; either version 2.1 of the License,
9   or (at your option) any later version.
10 
11   PulseAudio is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   General Public License for more details.
15 
16   You should have received a copy of the GNU Lesser General Public License
17   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
18 ***/
19 
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23 
24 #ifdef OS_IS_WIN32
25 
26 #include <stdlib.h>
27 #include <stdio.h>
28 
29 #include <windows.h>
30 #include <winsock2.h>
31 
32 extern char *pa_win32_get_toplevel(HANDLE handle);
33 
DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)34 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
35     WSADATA data;
36 
37     switch (fdwReason) {
38 
39     case DLL_PROCESS_ATTACH:
40         if (!pa_win32_get_toplevel(hinstDLL))
41             return FALSE;
42         WSAStartup(MAKEWORD(2, 0), &data);
43         break;
44 
45     case DLL_PROCESS_DETACH:
46         WSACleanup();
47         break;
48 
49     }
50     return TRUE;
51 }
52 
53 #endif /* OS_IS_WIN32 */
54