Mercurial > mplayer.hg
comparison loader/win32.c @ 5739:b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
author | alex |
---|---|
date | Sat, 20 Apr 2002 23:11:22 +0000 |
parents | 781a155f76cf |
children | 76dc22772901 |
comparison
equal
deleted
inserted
replaced
5738:ef3c2f82ea70 | 5739:b7e0cf4cb7a9 |
---|---|
185 fclose(f); | 185 fclose(f); |
186 } | 186 } |
187 va_end(va); | 187 va_end(va); |
188 } | 188 } |
189 #endif | 189 #endif |
190 #if 0 | 190 #undef MPLAYER |
191 // al3x: it break divx audio. btw it should be if(verbose>2){ ... } anyway... | 191 #ifdef MPLAYER |
192 // #ifdef MPLAYER | |
193 #include "../mp_msg.h" | 192 #include "../mp_msg.h" |
194 { | 193 if (verbose > 2) |
195 char buf[1024]; | 194 mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va); |
196 va_list va; | |
197 | |
198 va_start(va, fmt); | |
199 vsnprintf((char *)&buf[0], 1023, fmt, va); | |
200 mp_dbg(MSGT_WIN32, MSGL_DBG3, (char *)&buf[0]); | |
201 va_end(va); | |
202 } | |
203 #endif | 195 #endif |
204 } | 196 } |
205 | 197 |
206 | 198 |
207 char export_names[300][32]={ | 199 char export_names[300][32]={ |
1208 if (i < 0) | 1200 if (i < 0) |
1209 { | 1201 { |
1210 printf("InitializeCriticalSection(%p) - no more space in list\n", c); | 1202 printf("InitializeCriticalSection(%p) - no more space in list\n", c); |
1211 return; | 1203 return; |
1212 } | 1204 } |
1213 printf("got unused space at %d\n", i); | 1205 dbgprintf("got unused space at %d\n", i); |
1214 cs = expmalloc(sizeof(struct CRITSECT)); | 1206 cs = expmalloc(sizeof(struct CRITSECT)); |
1215 if (!cs) | 1207 if (!cs) |
1216 { | 1208 { |
1217 printf("InitializeCriticalSection(%p) - out of memory\n", c); | 1209 printf("InitializeCriticalSection(%p) - out of memory\n", c); |
1218 return; | 1210 return; |
1243 struct CRITSECT* cs=*(struct CRITSECT**)c; | 1235 struct CRITSECT* cs=*(struct CRITSECT**)c; |
1244 #endif | 1236 #endif |
1245 dbgprintf("EnterCriticalSection(0x%x)\n",c); | 1237 dbgprintf("EnterCriticalSection(0x%x)\n",c); |
1246 if (!cs) | 1238 if (!cs) |
1247 { | 1239 { |
1248 printf("entered uninitialized critisec!\n"); | 1240 dbgprintf("entered uninitialized critisec!\n"); |
1249 expInitializeCriticalSection(c); | 1241 expInitializeCriticalSection(c); |
1250 #ifdef CRITSECS_NEWTYPE | 1242 #ifdef CRITSECS_NEWTYPE |
1251 cs=critsecs_get_unix(c); | 1243 cs=critsecs_get_unix(c); |
1252 #else | 1244 #else |
1253 cs=*(struct CRITSECT**)c; | 1245 cs=*(struct CRITSECT**)c; |
1271 #endif | 1263 #endif |
1272 // struct CRITSECT* cs=(struct CRITSECT*)c; | 1264 // struct CRITSECT* cs=(struct CRITSECT*)c; |
1273 dbgprintf("LeaveCriticalSection(0x%x)\n",c); | 1265 dbgprintf("LeaveCriticalSection(0x%x)\n",c); |
1274 if (!cs) | 1266 if (!cs) |
1275 { | 1267 { |
1276 printf("Win32 Warning: Leaving noninitialized Critical Section %p!!\n", c); | 1268 printf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c); |
1277 return; | 1269 return; |
1278 } | 1270 } |
1279 cs->locked=0; | 1271 cs->locked=0; |
1280 pthread_mutex_unlock(&(cs->mutex)); | 1272 pthread_mutex_unlock(&(cs->mutex)); |
1281 return; | 1273 return; |
1324 return getpid(); | 1316 return getpid(); |
1325 } | 1317 } |
1326 | 1318 |
1327 extern void* fs_seg; | 1319 extern void* fs_seg; |
1328 | 1320 |
1329 #if 0 | 1321 #if 1 |
1330 // this version is required for Quicktime codecs (.qtx/.qts) to work. | 1322 // this version is required for Quicktime codecs (.qtx/.qts) to work. |
1331 // (they assume some pointers at FS: segment) | 1323 // (they assume some pointers at FS: segment) |
1332 | 1324 |
1333 //static int tls_count; | 1325 //static int tls_count; |
1334 static int tls_use_map[64]; | 1326 static int tls_use_map[64]; |
1965 //bool fun(HANDLE) | 1957 //bool fun(HANDLE) |
1966 //!0 on success | 1958 //!0 on success |
1967 static int WINAPI expCloseHandle(long v1) | 1959 static int WINAPI expCloseHandle(long v1) |
1968 { | 1960 { |
1969 dbgprintf("CloseHandle(0x%x) => 1\n", v1); | 1961 dbgprintf("CloseHandle(0x%x) => 1\n", v1); |
1962 /* do not close stdin,stdout and stderr */ | |
1963 if (v1 > 2) | |
1964 if (!close(v1)) | |
1965 return 0; | |
1970 return 1; | 1966 return 1; |
1971 } | 1967 } |
1972 | 1968 |
1973 static const char* WINAPI expGetCommandLineA() | 1969 static const char* WINAPI expGetCommandLineA() |
1974 { | 1970 { |
2947 r=open(tmp, flg); | 2943 r=open(tmp, flg); |
2948 free(tmp); | 2944 free(tmp); |
2949 return r; | 2945 return r; |
2950 } | 2946 } |
2951 | 2947 |
2948 #if 0 | |
2949 /* we need this for some virtualdub filters */ | |
2950 { | |
2951 int r; | |
2952 int flg = 0; | |
2953 if (GENERIC_READ & i1) | |
2954 flg |= O_RDONLY; | |
2955 else if (GENERIC_WRITE & i1) | |
2956 { | |
2957 flg |= O_WRONLY; | |
2958 printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", cs1, r, flg); | |
2959 } | |
2960 r=open(cs1, flg); | |
2961 return r; | |
2962 } | |
2963 #endif | |
2964 | |
2952 return atoi(cs1+2); | 2965 return atoi(cs1+2); |
2953 } | 2966 } |
2954 static UINT WINAPI expGetSystemDirectoryA( | 2967 static UINT WINAPI expGetSystemDirectoryA( |
2955 char* lpBuffer, // address of buffer for system directory | 2968 char* lpBuffer, // address of buffer for system directory |
2956 UINT uSize // size of directory buffer | 2969 UINT uSize // size of directory buffer |
2965 { | 2978 { |
2966 dbgprintf("GetSystemDirectoryA() => 0x%x='%s'\n", sysdir, sysdir); | 2979 dbgprintf("GetSystemDirectoryA() => 0x%x='%s'\n", sysdir, sysdir); |
2967 return sysdir; | 2980 return sysdir; |
2968 } | 2981 } |
2969 */ | 2982 */ |
2983 static DWORD WINAPI expGetFullPathNameA | |
2984 ( | |
2985 LPCTSTR lpFileName, | |
2986 DWORD nBufferLength, | |
2987 LPTSTR lpBuffer, | |
2988 LPTSTR lpFilePart | |
2989 ){ | |
2990 if(!lpFileName) return 0; | |
2991 dbgprintf("GetFullPathNameA('%s',%d,%p,%p)\n",lpFileName,nBufferLength, | |
2992 lpBuffer, lpFilePart); | |
2993 strcpy(lpFilePart, lpFileName); | |
2994 strcpy(lpBuffer, lpFileName); | |
2995 // strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName); | |
2996 return strlen(lpBuffer); | |
2997 } | |
2998 | |
2970 static DWORD WINAPI expGetShortPathNameA | 2999 static DWORD WINAPI expGetShortPathNameA |
2971 ( | 3000 ( |
2972 LPCSTR longpath, | 3001 LPCSTR longpath, |
2973 LPSTR shortpath, | 3002 LPSTR shortpath, |
2974 DWORD shortlen | 3003 DWORD shortlen |
3799 FF(GetTempFileNameA,-1) | 3828 FF(GetTempFileNameA,-1) |
3800 FF(CreateFileA,-1) | 3829 FF(CreateFileA,-1) |
3801 FF(GetSystemDirectoryA,-1) | 3830 FF(GetSystemDirectoryA,-1) |
3802 FF(GetWindowsDirectoryA,-1) | 3831 FF(GetWindowsDirectoryA,-1) |
3803 FF(GetShortPathNameA,-1) | 3832 FF(GetShortPathNameA,-1) |
3833 FF(GetFullPathNameA,-1) | |
3804 FF(SetErrorMode, -1) | 3834 FF(SetErrorMode, -1) |
3805 FF(IsProcessorFeaturePresent, -1) | 3835 FF(IsProcessorFeaturePresent, -1) |
3806 FF(GetProcessAffinityMask, -1) | 3836 FF(GetProcessAffinityMask, -1) |
3807 FF(InterlockedExchange, -1) | 3837 FF(InterlockedExchange, -1) |
3808 FF(MulDiv, -1) | 3838 FF(MulDiv, -1) |