[Mplayer-cvslog] CVS: main/loader ldt_keeper.c,1.4,1.5 win32.c,1.27,1.28 win32.h,1.5,1.6
Arpi of Ize
arpi at mplayer.dev.hu
Fri Nov 9 04:27:31 CET 2001
Update of /cvsroot/mplayer/main/loader
In directory mplayer:/var/tmp.root/cvs-serv1872
Modified Files:
ldt_keeper.c win32.c win32.h
Log Message:
Eugene's fixes to work with QuickTime.qts
Index: ldt_keeper.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/ldt_keeper.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ldt_keeper.c 8 Oct 2001 22:26:13 -0000 1.4
+++ ldt_keeper.c 9 Nov 2001 03:27:29 -0000 1.5
@@ -80,7 +80,7 @@
*
*/
-static void* fs_seg = NULL;
+void* fs_seg = NULL;
static char* prev_struct = NULL;
/**
* here is a small logical problem with Restore for multithreaded programs -
@@ -164,6 +164,8 @@
perror("ERROR: Couldn't allocate memory for fs segment");
return;
}
+ printf("fs seg %p\n", fs_seg);
+ *(void**)((char*)fs_seg+0x18) = fs_seg;
array.base_addr=(int)fs_seg;
array.entry_number=TEB_SEL_IDX;
array.limit=array.base_addr+getpagesize()-1;
Index: win32.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- win32.c 4 Nov 2001 02:43:25 -0000 1.27
+++ win32.c 9 Nov 2001 03:27:29 -0000 1.28
@@ -145,7 +145,7 @@
}
longcount(z);
}
-
+#define DETAILED_OUT
int LOADER_DEBUG=1; // active only if compiled with -DDETAILED_OUT
static inline void dbgprintf(char* fmt, ...)
{
@@ -702,6 +702,19 @@
// FIXME FIXME FIXME - this value is sometime unititialize !!!
int ret = WAIT_FAILED;
mutex_list* pp=mlist;
+ if(object == (void*)0xcfcf9898)
+ {
+/**
+From GetCurrentThread() documentation:
+A pseudo handle is a special constant that is interpreted as the current thread handle. The calling thread can use this handle to specify itself whenever a thread handle is required. Pseudo handles are not inherited by child processes.
+
+This handle has the maximum possible access to the thread object. For systems that support security descriptors, this is the maximum access allowed by the security descriptor for the calling process. For systems that do not support security descriptors, this is THREAD_ALL_ACCESS.
+
+The function cannot be used by one thread to create a handle that can be used by other threads to refer to the first thread. The handle is always interpreted as referring to the thread that is using it. A thread can create a "real" handle to itself that can be used by other threads, or inherited by other processes, by specifying the pseudo handle as the source handle in a call to the DuplicateHandle function.
+**/
+ dbgprintf("WaitForSingleObject(thread_handle) called\n");
+ return WAIT_FAILED;
+ }
dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration);
// loop below was slightly fixed - its used just for checking if
@@ -1266,6 +1279,47 @@
return getpid();
}
+extern void* fs_seg;
+
+#if 1
+//static int tls_count;
+static int tls_use_map[64];
+int WINAPI expTlsAlloc()
+{
+ int i;
+ for(i=0; i<64; i++)
+ if(tls_use_map[i]==0)
+ {
+ tls_use_map[i]=1;
+ return i;
+ }
+ return -1;
+}
+
+int WINAPI expTlsSetValue(int index, void* value)
+{
+ if((index<0) || (index>64))
+ return 0;
+ *(void**)((char*)fs_seg+0x88+4*index) = value;
+ return 1;
+}
+
+void* WINAPI expTlsGetValue(int index)
+{
+ if((index<0) || (index>64))
+ return 0;
+ return *(void**)((char*)fs_seg+0x88+index);
+}
+
+int WINAPI expTlsFree(int index)
+{
+ if((index<0) || (index>64))
+ return 0;
+ tls_use_map[index]=0;
+ return 1;
+}
+
+#else
struct tls_s {
void* value;
int used;
@@ -1274,7 +1328,6 @@
};
tls_t* g_tls=NULL;
-
void* WINAPI expTlsAlloc()
{
if(g_tls==NULL)
@@ -1335,6 +1388,8 @@
dbgprintf("TlsFree(index 0x%x) => %d\n", index, result);
return result;
}
+#endif
+
void* WINAPI expLocalAlloc(int flags, int size)
{
void* z;
@@ -2498,7 +2553,7 @@
int WINAPI expGetCurrentThread(void)
{
dbgprintf("GetCurrentThread()\n");
- return 1;
+ return 0xcfcf9898;
}
int WINAPI expGetOEMCP(void)
{
@@ -3001,6 +3056,25 @@
// return S_OK;
}
+
+int WINAPI expDuplicateHandle(
+ HANDLE hSourceProcessHandle, // handle to source process
+ HANDLE hSourceHandle, // handle to duplicate
+ HANDLE hTargetProcessHandle, // handle to target process
+ HANDLE* lpTargetHandle, // duplicate handle
+ DWORD dwDesiredAccess, // requested access
+ int bInheritHandle, // handle inheritance option
+ DWORD dwOptions // optional actions
+ )
+{
+ dbgprintf("DuplicateHandle(%p, %p, %p, %p, 0x%x, %d, %d) called\n",
+ hSourceProcessHandle, hSourceHandle, hTargetProcessHandle,
+ lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions);
+ *lpTargetHandle = hSourceHandle;
+ return 1;
+}
+
+
struct exports
{
char name[64];
@@ -3137,6 +3211,7 @@
FF(GetCurrentThread,-1)
FF(GetOEMCP,-1)
FF(GetCPInfo,-1)
+FF(DuplicateHandle,-1)
};
struct exports exp_msvcrt[]={
Index: win32.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- win32.h 3 Nov 2001 19:40:38 -0000 1.5
+++ win32.h 9 Nov 2001 03:27:29 -0000 1.6
@@ -59,10 +59,10 @@
extern void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c);
extern int WINAPI expGetCurrentThreadId(void);
extern int WINAPI expGetCurrentProcess(void);
-extern void* WINAPI expTlsAlloc(void);
-extern int WINAPI expTlsSetValue(tls_t* index, void* value);
-extern void* WINAPI expTlsGetValue(tls_t* index);
-extern int WINAPI expTlsFree(tls_t* index);
+//extern void* WINAPI expTlsAlloc(void);
+//extern int WINAPI expTlsSetValue(tls_t* index, void* value);
+//extern void* WINAPI expTlsGetValue(tls_t* index);
+//extern int WINAPI expTlsFree(tls_t* index);
extern void* WINAPI expLocalAlloc(int flags, int size);
extern void* WINAPI expLocalReAlloc(int handle,int size,int flags);
extern void* WINAPI expLocalLock(void* z);
More information about the MPlayer-cvslog
mailing list