Mercurial > mplayer.hg
annotate loader/drv.c @ 35980:613cb10f919c
Cosmetic: Rename HidePlayList() HidePlaylist().
author | ib |
---|---|
date | Thu, 28 Mar 2013 17:19:13 +0000 |
parents | 76a13038105e |
children |
rev | line source |
---|---|
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
1 /* |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
2 * Modified for use with MPlayer, detailed changelog at |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
3 * http://svn.mplayerhq.hu/mplayer/trunk/ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
4 */ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
5 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
6 #include "config.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
7 #include "debug.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
8 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
9 #include <stdio.h> |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
10 #include <stdlib.h> |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
11 #ifdef __FreeBSD__ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
12 #include <sys/time.h> |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
13 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
14 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
15 #include "win32.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
16 #include "wine/driver.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
17 #include "wine/pe_image.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
18 #include "wine/winreg.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
19 #include "wine/vfw.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
20 #include "registry.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
21 #ifdef WIN32_LOADER |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
22 #include "ldt_keeper.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
23 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
24 #include "drv.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
25 #ifndef __MINGW32__ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
26 #include "ext.h" |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
27 #endif |
30901 | 28 #include "path.h" |
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
29 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
30 #if 1 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
31 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
32 /* |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
33 * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
34 * WINAPI/no-WINAPI bustage. |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
35 * |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
36 * There should be no need for the STORE_ALL/REST_ALL hack once all |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
37 * function definitions agree with their prototypes (WINAPI-wise) and |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
38 * we make sure, that we do not call these functions without a proper |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
39 * prototype in scope. |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
40 */ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
41 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
42 #define STORE_ALL |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
43 #define REST_ALL |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
44 #else |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
45 // this asm code is no longer needed |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
46 #define STORE_ALL \ |
27757
b5a46071062a
Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents:
26999
diff
changeset
|
47 __asm__ volatile ( \ |
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
48 "push %%ebx\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
49 "push %%ecx\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
50 "push %%edx\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
51 "push %%esi\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
52 "push %%edi\n\t"::) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
53 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
54 #define REST_ALL \ |
27757
b5a46071062a
Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents:
26999
diff
changeset
|
55 __asm__ volatile ( \ |
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
56 "pop %%edi\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
57 "pop %%esi\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
58 "pop %%edx\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
59 "pop %%ecx\n\t" \ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
60 "pop %%ebx\n\t"::) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
61 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
62 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
63 static DWORD dwDrvID = 0; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
64 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
65 LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message, |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
66 LPARAM lParam1, LPARAM lParam2) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
67 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
68 DRVR* module=(DRVR*)hDriver; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
69 int result; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
70 #ifndef __svr4__ |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
71 char qw[300]; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
72 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
73 #ifdef DETAILED_OUT |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
74 printf("SendDriverMessage: driver %X, message %X, arg1 %X, arg2 %X\n", hDriver, message, lParam1, lParam2); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
75 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
76 if (!module || !module->hDriverModule || !module->DriverProc) return -1; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
77 #ifndef __svr4__ |
27757
b5a46071062a
Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents:
26999
diff
changeset
|
78 __asm__ volatile ("fsave (%0)\n\t": :"r"(&qw)); |
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
79 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
80 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
81 #ifdef WIN32_LOADER |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
82 Setup_FS_Segment(); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
83 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
84 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
85 STORE_ALL; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
86 result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
87 REST_ALL; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
88 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
89 #ifndef __svr4__ |
27757
b5a46071062a
Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents:
26999
diff
changeset
|
90 __asm__ volatile ("frstor (%0)\n\t": :"r"(&qw)); |
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
91 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
92 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
93 #ifdef DETAILED_OUT |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
94 printf("\t\tResult: %X\n", result); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
95 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
96 return result; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
97 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
98 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
99 void DrvClose(HDRVR hDriver) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
100 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
101 if (hDriver) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
102 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
103 DRVR* d = (DRVR*)hDriver; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
104 if (d->hDriverModule) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
105 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
106 #ifdef WIN32_LOADER |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
107 Setup_FS_Segment(); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
108 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
109 if (d->DriverProc) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
110 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
111 SendDriverMessage(hDriver, DRV_CLOSE, 0, 0); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
112 d->dwDriverID = 0; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
113 SendDriverMessage(hDriver, DRV_FREE, 0, 0); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
114 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
115 FreeLibrary(d->hDriverModule); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
116 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
117 free(d); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
118 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
119 #ifdef WIN32_LOADER |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
120 CodecRelease(); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
121 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
122 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
123 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
124 //DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
125 HDRVR DrvOpen(LPARAM lParam2) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
126 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
127 NPDRVR hDriver; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
128 char unknown[0x124]; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
129 const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
130 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
131 #ifdef WIN32_LOADER |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
132 Setup_LDT_Keeper(); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
133 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
134 printf("Loading codec DLL: '%s'\n",filename); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
135 |
30702 | 136 hDriver = malloc(sizeof(DRVR)); |
26999
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
137 if (!hDriver) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
138 return (HDRVR) 0; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
139 memset((void*)hDriver, 0, sizeof(DRVR)); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
140 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
141 #ifdef WIN32_LOADER |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
142 CodecAlloc(); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
143 Setup_FS_Segment(); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
144 #endif |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
145 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
146 hDriver->hDriverModule = LoadLibraryA(filename); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
147 if (!hDriver->hDriverModule) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
148 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
149 printf("Can't open library %s\n", filename); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
150 DrvClose((HDRVR)hDriver); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
151 return (HDRVR) 0; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
152 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
153 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
154 hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule, |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
155 "DriverProc"); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
156 if (!hDriver->DriverProc) |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
157 { |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
158 printf("Library %s is not a valid VfW/ACM codec\n", filename); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
159 DrvClose((HDRVR)hDriver); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
160 return (HDRVR) 0; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
161 } |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
162 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
163 TRACE("DriverProc == %X\n", hDriver->DriverProc); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
164 SendDriverMessage((HDRVR)hDriver, DRV_LOAD, 0, 0); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
165 TRACE("DRV_LOAD Ok!\n"); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
166 SendDriverMessage((HDRVR)hDriver, DRV_ENABLE, 0, 0); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
167 TRACE("DRV_ENABLE Ok!\n"); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
168 hDriver->dwDriverID = ++dwDrvID; // generate new id |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
169 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
170 // open driver and remmeber proper DriverID |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
171 hDriver->dwDriverID = SendDriverMessage((HDRVR)hDriver, DRV_OPEN, (LPARAM) unknown, lParam2); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
172 TRACE("DRV_OPEN Ok!(%X)\n", hDriver->dwDriverID); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
173 |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
174 printf("Loaded DLL driver %s at %x\n", filename, hDriver->hDriverModule); |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
175 return (HDRVR)hDriver; |
0b21ffa03b9c
Rename loader/driver.[ch] to loader/drv.[ch], otherwise loader/driver.h can
diego
parents:
diff
changeset
|
176 } |