Implement SetFileApisToOEM, SetFileApisToANSI and AreFileApisANSI

Dmitry Timoshkov dmitry at sloboda.ru
Mon Mar 5 08:18:35 CST 2001


Hello.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Implement SetFileApisToOEM, SetFileApisToANSI and AreFileApisANSI.

diff -u cvs/wine/include/process.h wine/include/process.h
--- cvs/wine/include/process.h	Mon Feb 12 11:38:46 2001
+++ wine/include/process.h	Mon Mar  5 21:58:29 2001
@@ -11,13 +11,65 @@
 extern "C" {
 #endif
 
-typedef void (*LPBEGINTHREAD)(LPVOID);
-typedef UINT WINAPI (*LPBEGINTHREADEX)(LPVOID);
+/* Process flags */
+#define PDB32_DEBUGGED      0x0001  /* Process is being debugged */
+#define PDB32_WIN16_PROC    0x0008  /* Win16 process */
+#define PDB32_DOS_PROC      0x0010  /* Dos process */
+#define PDB32_CONSOLE_PROC  0x0020  /* Console process */
+#define PDB32_FILE_APIS_OEM 0x0040  /* File APIs are OEM */
+#define PDB32_WIN32S_PROC   0x8000  /* Win32s process */
 
-ULONG _beginthread(LPBEGINTHREAD,UINT,LPVOID);
-void  _endthread(void);
-ULONG _beginthreadex(LPVOID,UINT,LPBEGINTHREADEX,LPVOID,UINT,LPUINT);
-void  _endthreadex(UINT);
+struct _ENVDB;
+
+/* Win32 process database */
+typedef struct _PDB
+{
+    LONG             header[2];        /* 00 Kernel object header */
+    HMODULE          module;           /* 08 Main exe module (NT) */
+    void            *event;            /* 0c Pointer to an event object (unused) */
+    DWORD            exit_code;        /* 10 Process exit code */
+    DWORD            unknown2;         /* 14 Unknown */
+    HANDLE           heap;             /* 18 Default process heap */
+    HANDLE           mem_context;      /* 1c Process memory context */
+    DWORD            flags;            /* 20 Flags */
+    void            *pdb16;            /* 24 DOS PSP */
+    WORD             PSP_sel;          /* 28 Selector to DOS PSP */
+    WORD             imte;             /* 2a IMTE for the process module */
+    WORD             threads;          /* 2c Number of threads */
+    WORD             running_threads;  /* 2e Number of running threads */
+    WORD             free_lib_count;   /* 30 Recursion depth of FreeLibrary calls */
+    WORD             ring0_threads;    /* 32 Number of ring 0 threads */
+    HANDLE           system_heap;      /* 34 System heap to allocate handles */
+    HTASK            task;             /* 38 Win16 task */
+    void            *mem_map_files;    /* 3c Pointer to mem-mapped files */
+    struct _ENVDB   *env_db;           /* 40 Environment database */
+    void            *handle_table;     /* 44 Handle table */
+    struct _PDB     *parent;           /* 48 Parent process */
+    void            *modref_list;      /* 4c MODREF list */
+    void            *thread_list;      /* 50 List of threads */
+    void            *debuggee_CB;      /* 54 Debuggee context block */
+    void            *local_heap_free;  /* 58 Head of local heap free list */
+    DWORD            unknown4;         /* 5c Unknown */
+    CRITICAL_SECTION crit_section;     /* 60 Critical section */
+    DWORD            unknown5[3];      /* 78 Unknown */
+    void            *console;          /* 84 Console */
+    DWORD            tls_bits[2];      /* 88 TLS in-use bits */
+    DWORD            process_dword;    /* 90 Unknown */
+    struct _PDB     *group;            /* 94 Process group */
+    void            *exe_modref;       /* 98 MODREF for the process EXE */
+    void            *top_filter;       /* 9c Top exception filter */
+    DWORD            priority;         /* a0 Priority level */
+    HANDLE           heap_list;        /* a4 Head of process heap list */
+    void            *heap_handles;     /* a8 Head of heap handles list */
+    DWORD            unknown6;         /* ac Unknown */
+    void            *console_provider; /* b0 Console provider (??) */
+    WORD             env_selector;     /* b4 Selector to process environment */
+    WORD             error_mode;       /* b6 Error mode */
+    HANDLE           load_done_evt;    /* b8 Event for process loading done */
+    void            *UTState;          /* bc Head of Univeral Thunk list */
+    DWORD            unknown8;         /* c0 Unknown (NT) */
+    LCID             locale;           /* c4 Locale to be queried by GetThreadLocale (NT) */
+} PDB;
 
 #ifdef __cplusplus
 }
diff -u cvs/wine/scheduler/process.c wine/scheduler/process.c
--- cvs/wine/scheduler/process.c	Fri Mar  2 06:13:49 2001
+++ wine/scheduler/process.c	Mon Mar  5 21:48:51 2001
@@ -18,6 +18,7 @@
 #include "drive.h"
 #include "module.h"
 #include "file.h"
+#include "process.h"
 #include "thread.h"
 #include "winerror.h"
 #include "server.h"
@@ -29,67 +30,7 @@
 DECLARE_DEBUG_CHANNEL(relay);
 DECLARE_DEBUG_CHANNEL(win32);
 
-struct _ENVDB;
-
-/* Win32 process database */
-typedef struct _PDB
-{
-    LONG             header[2];        /* 00 Kernel object header */
-    HMODULE          module;           /* 08 Main exe module (NT) */
-    void            *event;            /* 0c Pointer to an event object (unused) */
-    DWORD            exit_code;        /* 10 Process exit code */
-    DWORD            unknown2;         /* 14 Unknown */
-    HANDLE           heap;             /* 18 Default process heap */
-    HANDLE           mem_context;      /* 1c Process memory context */
-    DWORD            flags;            /* 20 Flags */
-    void            *pdb16;            /* 24 DOS PSP */
-    WORD             PSP_sel;          /* 28 Selector to DOS PSP */
-    WORD             imte;             /* 2a IMTE for the process module */
-    WORD             threads;          /* 2c Number of threads */
-    WORD             running_threads;  /* 2e Number of running threads */
-    WORD             free_lib_count;   /* 30 Recursion depth of FreeLibrary calls */
-    WORD             ring0_threads;    /* 32 Number of ring 0 threads */
-    HANDLE           system_heap;      /* 34 System heap to allocate handles */
-    HTASK            task;             /* 38 Win16 task */
-    void            *mem_map_files;    /* 3c Pointer to mem-mapped files */
-    struct _ENVDB   *env_db;           /* 40 Environment database */
-    void            *handle_table;     /* 44 Handle table */
-    struct _PDB     *parent;           /* 48 Parent process */
-    void            *modref_list;      /* 4c MODREF list */
-    void            *thread_list;      /* 50 List of threads */
-    void            *debuggee_CB;      /* 54 Debuggee context block */
-    void            *local_heap_free;  /* 58 Head of local heap free list */
-    DWORD            unknown4;         /* 5c Unknown */
-    CRITICAL_SECTION crit_section;     /* 60 Critical section */
-    DWORD            unknown5[3];      /* 78 Unknown */
-    void            *console;          /* 84 Console */
-    DWORD            tls_bits[2];      /* 88 TLS in-use bits */
-    DWORD            process_dword;    /* 90 Unknown */
-    struct _PDB     *group;            /* 94 Process group */
-    void            *exe_modref;       /* 98 MODREF for the process EXE */
-    void            *top_filter;       /* 9c Top exception filter */
-    DWORD            priority;         /* a0 Priority level */
-    HANDLE           heap_list;        /* a4 Head of process heap list */
-    void            *heap_handles;     /* a8 Head of heap handles list */
-    DWORD            unknown6;         /* ac Unknown */
-    void            *console_provider; /* b0 Console provider (??) */
-    WORD             env_selector;     /* b4 Selector to process environment */
-    WORD             error_mode;       /* b6 Error mode */
-    HANDLE           load_done_evt;    /* b8 Event for process loading done */
-    void            *UTState;          /* bc Head of Univeral Thunk list */
-    DWORD            unknown8;         /* c0 Unknown (NT) */
-    LCID             locale;           /* c4 Locale to be queried by GetThreadLocale (NT) */
-} PDB;
-
 PDB current_process;
-
-/* Process flags */
-#define PDB32_DEBUGGED      0x0001  /* Process is being debugged */
-#define PDB32_WIN16_PROC    0x0008  /* Win16 process */
-#define PDB32_DOS_PROC      0x0010  /* Dos process */
-#define PDB32_CONSOLE_PROC  0x0020  /* Console process */
-#define PDB32_FILE_APIS_OEM 0x0040  /* File APIs are OEM */
-#define PDB32_WIN32S_PROC   0x8000  /* Win32s process */
 
 static char **main_exe_argv;
 static char main_exe_name[MAX_PATH];
diff -u cvs/wine/win32/file.c wine/win32/file.c
--- cvs/wine/win32/file.c	Thu Feb 15 07:11:20 2001
+++ wine/win32/file.c	Mon Mar  5 22:12:03 2001
@@ -24,10 +24,13 @@
 #include "winerror.h"
 #include "file.h"
 #include "heap.h"
+#include "process.h"
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(file);
 
+extern PDB current_process;
+
 /***********************************************************************
  *              ReadFileEx                (KERNEL32.@)
  */
@@ -126,7 +129,7 @@
  */
 VOID WINAPI SetFileApisToOEM(void)
 {
-  /*FIXME(file,"(): stub!\n");*/
+    current_process.flags |= PDB32_FILE_APIS_OEM;
 }
 
 
@@ -135,7 +138,7 @@
  */
 VOID WINAPI SetFileApisToANSI(void)
 {
-    /*FIXME(file,"(): stub\n");*/
+    current_process.flags &= ~PDB32_FILE_APIS_OEM;
 }
 
 
@@ -148,7 +151,6 @@
  */
 BOOL WINAPI AreFileApisANSI(void)
 {
-    FIXME("(void): stub\n");
-    return TRUE;
+    return !(current_process.flags & PDB32_FILE_APIS_OEM);
 }
 






More information about the wine-patches mailing list