fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5740 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
alex 2002-04-20 23:11:22 +00:00
parent 73740548f8
commit b0781e5b42
1 changed files with 46 additions and 16 deletions

View File

@ -187,19 +187,11 @@ static inline void dbgprintf(char* fmt, ...)
va_end(va); va_end(va);
} }
#endif #endif
#if 0 #undef MPLAYER
// al3x: it break divx audio. btw it should be if(verbose>2){ ... } anyway... #ifdef MPLAYER
// #ifdef MPLAYER
#include "../mp_msg.h" #include "../mp_msg.h"
{ if (verbose > 2)
char buf[1024]; mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va);
va_list va;
va_start(va, fmt);
vsnprintf((char *)&buf[0], 1023, fmt, va);
mp_dbg(MSGT_WIN32, MSGL_DBG3, (char *)&buf[0]);
va_end(va);
}
#endif #endif
} }
@ -1210,7 +1202,7 @@ static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c)
printf("InitializeCriticalSection(%p) - no more space in list\n", c); printf("InitializeCriticalSection(%p) - no more space in list\n", c);
return; return;
} }
printf("got unused space at %d\n", i); dbgprintf("got unused space at %d\n", i);
cs = expmalloc(sizeof(struct CRITSECT)); cs = expmalloc(sizeof(struct CRITSECT));
if (!cs) if (!cs)
{ {
@ -1245,7 +1237,7 @@ static void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c)
dbgprintf("EnterCriticalSection(0x%x)\n",c); dbgprintf("EnterCriticalSection(0x%x)\n",c);
if (!cs) if (!cs)
{ {
printf("entered uninitialized critisec!\n"); dbgprintf("entered uninitialized critisec!\n");
expInitializeCriticalSection(c); expInitializeCriticalSection(c);
#ifdef CRITSECS_NEWTYPE #ifdef CRITSECS_NEWTYPE
cs=critsecs_get_unix(c); cs=critsecs_get_unix(c);
@ -1273,7 +1265,7 @@ static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c)
dbgprintf("LeaveCriticalSection(0x%x)\n",c); dbgprintf("LeaveCriticalSection(0x%x)\n",c);
if (!cs) if (!cs)
{ {
printf("Win32 Warning: Leaving noninitialized Critical Section %p!!\n", c); printf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c);
return; return;
} }
cs->locked=0; cs->locked=0;
@ -1326,7 +1318,7 @@ static int WINAPI expGetCurrentProcess()
extern void* fs_seg; extern void* fs_seg;
#if 0 #if 1
// this version is required for Quicktime codecs (.qtx/.qts) to work. // this version is required for Quicktime codecs (.qtx/.qts) to work.
// (they assume some pointers at FS: segment) // (they assume some pointers at FS: segment)
@ -1967,6 +1959,10 @@ static int WINAPI expFreeResource(long res)
static int WINAPI expCloseHandle(long v1) static int WINAPI expCloseHandle(long v1)
{ {
dbgprintf("CloseHandle(0x%x) => 1\n", v1); dbgprintf("CloseHandle(0x%x) => 1\n", v1);
/* do not close stdin,stdout and stderr */
if (v1 > 2)
if (!close(v1))
return 0;
return 1; return 1;
} }
@ -2949,6 +2945,23 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
return r; return r;
} }
#if 0
/* we need this for some virtualdub filters */
{
int r;
int flg = 0;
if (GENERIC_READ & i1)
flg |= O_RDONLY;
else if (GENERIC_WRITE & i1)
{
flg |= O_WRONLY;
printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", cs1, r, flg);
}
r=open(cs1, flg);
return r;
}
#endif
return atoi(cs1+2); return atoi(cs1+2);
} }
static UINT WINAPI expGetSystemDirectoryA( static UINT WINAPI expGetSystemDirectoryA(
@ -2967,6 +2980,22 @@ static LPCSTR WINAPI expGetSystemDirectoryA()
return sysdir; return sysdir;
} }
*/ */
static DWORD WINAPI expGetFullPathNameA
(
LPCTSTR lpFileName,
DWORD nBufferLength,
LPTSTR lpBuffer,
LPTSTR lpFilePart
){
if(!lpFileName) return 0;
dbgprintf("GetFullPathNameA('%s',%d,%p,%p)\n",lpFileName,nBufferLength,
lpBuffer, lpFilePart);
strcpy(lpFilePart, lpFileName);
strcpy(lpBuffer, lpFileName);
// strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName);
return strlen(lpBuffer);
}
static DWORD WINAPI expGetShortPathNameA static DWORD WINAPI expGetShortPathNameA
( (
LPCSTR longpath, LPCSTR longpath,
@ -3801,6 +3830,7 @@ struct exports exp_kernel32[]=
FF(GetSystemDirectoryA,-1) FF(GetSystemDirectoryA,-1)
FF(GetWindowsDirectoryA,-1) FF(GetWindowsDirectoryA,-1)
FF(GetShortPathNameA,-1) FF(GetShortPathNameA,-1)
FF(GetFullPathNameA,-1)
FF(SetErrorMode, -1) FF(SetErrorMode, -1)
FF(IsProcessorFeaturePresent, -1) FF(IsProcessorFeaturePresent, -1)
FF(GetProcessAffinityMask, -1) FF(GetProcessAffinityMask, -1)