annotate loader/driver.c @ 18715:30d7ddf08889

Fix window position when changing videos while in fullscreen and for window managers that modify position on Map. Oked by Alexander Strasser.
author reimar
date Thu, 15 Jun 2006 08:00:37 +0000
parents f5537cc95b02
children 0783dd397f74
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 12655
diff changeset
1 /*
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 12655
diff changeset
2 * Modified for use with MPlayer, detailed CVS changelog at
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 12655
diff changeset
3 * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 12655
diff changeset
4 * $Id$
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 12655
diff changeset
5 */
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 12655
diff changeset
6
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
7 #include "config.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
8
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 #ifdef HAVE_MALLOC_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include <malloc.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
12 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #include <stdlib.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
14 #ifdef __FreeBSD__
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
15 #include <sys/time.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17
2068
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
18 #include "win32.h"
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
19 #include "wine/driver.h"
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
20 #include "wine/pe_image.h"
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
21 #include "wine/winreg.h"
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
22 #include "wine/vfw.h"
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
23 #include "registry.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
24 #ifdef WIN32_LOADER
2068
3189c317dfc1 using ldt_keeper instead of setup_fs, includes changed
arpi
parents: 1307
diff changeset
25 #include "ldt_keeper.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
26 #endif
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
27 #include "driver.h"
9978
11cee15b1a8f last mingw32 support patch by Sascha Sommer
alex
parents: 9967
diff changeset
28 #ifndef __MINGW32__
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 7386
diff changeset
29 #include "ext.h"
9978
11cee15b1a8f last mingw32 support patch by Sascha Sommer
alex
parents: 9967
diff changeset
30 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
32 #ifndef WIN32_LOADER
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
33 char* def_path=WIN32_PATH;
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
34 #else
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
35 extern char* def_path;
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
36 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
38 #if 1
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
39
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
40 /*
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
41 * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
42 * WINAPI/no-WINAPI bustage.
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
43 *
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
44 * There should be no need for the STORE_ALL/REST_ALL hack once all
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
45 * function definitions agree with their prototypes (WINAPI-wise) and
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
46 * we make sure, that we do not call these functions without a proper
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
47 * prototype in scope.
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
48 */
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
49
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
50 #define STORE_ALL
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
51 #define REST_ALL
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
52 #else
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
53 // this asm code is no longer needed
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 #define STORE_ALL \
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
55 __asm__ __volatile__ ( \
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 "push %%ebx\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 "push %%ecx\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 "push %%edx\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 "push %%esi\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 "push %%edi\n\t"::)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 #define REST_ALL \
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
63 __asm__ __volatile__ ( \
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 "pop %%edi\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 "pop %%esi\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 "pop %%edx\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 "pop %%ecx\n\t" \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 "pop %%ebx\n\t"::)
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
69 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
71 static int needs_free=0;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
72 void SetCodecPath(const char* path)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
73 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
74 if(needs_free)free(def_path);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
75 if(path==0)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
76 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
77 def_path=WIN32_PATH;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
78 needs_free=0;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
79 return;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
80 }
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
81 def_path = (char*) malloc(strlen(path)+1);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
82 strcpy(def_path, path);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
83 needs_free=1;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
84 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 static DWORD dwDrvID = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
88 LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
89 LPARAM lParam1, LPARAM lParam2)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 DRVR* module=(DRVR*)hDriver;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 int result;
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
93 #ifndef __svr4__
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
94 char qw[300];
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
95 #endif
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
96 #ifdef DETAILED_OUT
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 printf("SendDriverMessage: driver %X, message %X, arg1 %X, arg2 %X\n", hDriver, message, lParam1, lParam2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 #endif
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
99 if (!module || !module->hDriverModule || !module->DriverProc) return -1;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
100 #ifndef __svr4__
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
101 __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
102 #endif
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
103
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
104 #ifdef WIN32_LOADER
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
105 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
106 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
108 STORE_ALL;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
109 result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
110 REST_ALL;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
111
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
112 #ifndef __svr4__
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
113 __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw));
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
114 #endif
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
115
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
116 #ifdef DETAILED_OUT
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
117 printf("\t\tResult: %X\n", result);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
118 #endif
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
119 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
122 void DrvClose(HDRVR hDriver)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
124 if (hDriver)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
125 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
126 DRVR* d = (DRVR*)hDriver;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
127 if (d->hDriverModule)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
128 {
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
129 #ifdef WIN32_LOADER
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
130 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
131 #endif
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
132 if (d->DriverProc)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
133 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
134 SendDriverMessage(hDriver, DRV_CLOSE, 0, 0);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
135 d->dwDriverID = 0;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
136 SendDriverMessage(hDriver, DRV_FREE, 0, 0);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
137 }
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
138 FreeLibrary(d->hDriverModule);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
139 }
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
140 free(d);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 }
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
142 #ifdef WIN32_LOADER
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
143 CodecRelease();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
144 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
147 //DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
148 HDRVR DrvOpen(LPARAM lParam2)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
150 NPDRVR hDriver;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
151 int i;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
152 char unknown[0x124];
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
153 const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
155 #ifdef MPLAYER
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
156 #ifdef WIN32_LOADER
236
a2c9731b2e01 Setup_FS_Segment() for VoxWare audio
arpi_esp
parents: 185
diff changeset
157 Setup_LDT_Keeper();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
158 #endif
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
159 printf("Loading codec DLL: '%s'\n",filename);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
160 #endif
236
a2c9731b2e01 Setup_FS_Segment() for VoxWare audio
arpi_esp
parents: 185
diff changeset
161
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
162 hDriver = (NPDRVR) malloc(sizeof(DRVR));
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
163 if (!hDriver)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 return ((HDRVR) 0);
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
165 memset((void*)hDriver, 0, sizeof(DRVR));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
167 #ifdef WIN32_LOADER
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
168 CodecAlloc();
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
169 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 8451
diff changeset
170 #endif
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
171
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
172 hDriver->hDriverModule = LoadLibraryA(filename);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
173 if (!hDriver->hDriverModule)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
174 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
175 printf("Can't open library %s\n", filename);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
176 DrvClose((HDRVR)hDriver);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
177 return ((HDRVR) 0);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
180 hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule,
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
181 "DriverProc");
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
182 if (!hDriver->DriverProc)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
184 printf("Library %s is not a valid VfW/ACM codec\n", filename);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
185 DrvClose((HDRVR)hDriver);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
186 return ((HDRVR) 0);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
189 TRACE("DriverProc == %X\n", hDriver->DriverProc);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
190 SendDriverMessage((HDRVR)hDriver, DRV_LOAD, 0, 0);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
191 TRACE("DRV_LOAD Ok!\n");
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
192 SendDriverMessage((HDRVR)hDriver, DRV_ENABLE, 0, 0);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
193 TRACE("DRV_ENABLE Ok!\n");
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
194 hDriver->dwDriverID = ++dwDrvID; // generate new id
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
196 // open driver and remmeber proper DriverID
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
197 hDriver->dwDriverID = SendDriverMessage((HDRVR)hDriver, DRV_OPEN, (LPARAM) unknown, lParam2);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
198 TRACE("DRV_OPEN Ok!(%X)\n", hDriver->dwDriverID);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199
12655
d1d0b81f15c9 more verbosity
alex
parents: 9978
diff changeset
200 printf("Loaded DLL driver %s at %x\n", filename, hDriver->hDriverModule);
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3465
diff changeset
201 return (HDRVR)hDriver;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 }