Browse Source

*wince: criticalsection

git-svn-id: trunk@3684 -
oro06 19 years ago
parent
commit
2c84728dc1
3 changed files with 29 additions and 33 deletions
  1. 11 0
      rtl/win/sysosh.inc
  2. 3 17
      rtl/wince/wininc/coredll.inc
  3. 15 16
      rtl/wince/wininc/redef.inc

+ 11 - 0
rtl/win/sysosh.inc

@@ -29,6 +29,7 @@ type
   { and they shouldn't be used in a program     }
   { only the type TCriticalSection is important }
   PRTLCriticalSection = ^TRTLCriticalSection;
+{$ifndef WINCE}
   TRTLCriticalSection = packed record
     DebugInfo : pointer;
     LockCount : longint;
@@ -37,6 +38,16 @@ type
     LockSemaphore : THandle;
     SpinCount : ULONG_PTR;
   end;
+{$else WINCE}
+  //CE only
+  TRTLCriticalSection = packed record
+    LockCount     : uint ;    // Nesting count on critical section
+    OwnerThread   : THandle; 	// Handle of owner thread
+    hCrit         : THandle;	// Handle to this critical section
+    needtrap      : DWORD;	// Trap in when freeing critical section
+    dwContentions : DWORD ;	// Count of contentions
+  end;
+{$endif WINCE}
 
 const
 {$ifdef WINCE}

+ 3 - 17
rtl/wince/wininc/coredll.inc

@@ -297,7 +297,6 @@
       198 DefWindowProcW
       1B1 DeferWindowPos
        FF DeleteAndRenameFile
-        7 DeleteCriticalSection
       4FD DeleteDC
       535 DeleteEnhMetaFile
        EE DeleteFileW
@@ -340,7 +339,6 @@
       536 EndDoc
       537 EndPage
       196 EndPaint
-        8 EnterCriticalSection
       12D EnumCalendarInfoW
       3E3 EnumClipboardFormats
       12F EnumDateFormatsW
@@ -535,7 +533,6 @@
       558 GetScrollInfo
       16F GetServiceByIndex
       174 GetServiceHandle
-      5CB GetStdioPathW
       505 GetStockObject
       102 GetStoreInformation
       139 GetStringTypeExW
@@ -697,7 +694,6 @@
       4C0 InSendMessage
        A5 InflateRect
         D InitLocale
-        6 InitializeCriticalSection
       38C InputDebugCharW
       4A1 InsertMenuW
       349 Int_CloseHandle
@@ -755,7 +751,6 @@
       4C6 KillTimer
       126 LCMapStringW
       38E LeaveCritSec
-        9 LeaveCriticalSection
       525 LineTo
        A2 LoadAcceleratorsW
       41E LoadAnimatedCursor
@@ -789,7 +784,6 @@
       34F MapCallerPtr
       3F9 MapDialogRect
       350 MapPtrToProcWithSize
-      38F MapPtrToProcess
       390 MapPtrUnsecure
       342 MapViewOfFile
       48C MapVirtualKeyW
@@ -1065,7 +1059,6 @@
       555 SetScrollInfo
       556 SetScrollPos
       557 SetScrollRange
-      5CC SetStdioPathW
       4D7 SetSysColors
       135 SetSystemDefaultLCID
       17D SetSystemMemoryDivision
@@ -1191,7 +1184,6 @@
       4BD TranslateMessage
        BC TransmitCommChar
       4F5 TransparentImage
-      355 TryEnterCriticalSection
       3A6 TurnOffProfiling
       3A5 TurnOnProfiling
       36C U_rclose
@@ -1547,7 +1539,6 @@
       198 __imp_DefWindowProcW
       1B1 __imp_DeferWindowPos
        FF __imp_DeleteAndRenameFile
-        7 __imp_DeleteCriticalSection
       4FD __imp_DeleteDC
       535 __imp_DeleteEnhMetaFile
        EE __imp_DeleteFileW
@@ -1590,7 +1581,6 @@
       536 __imp_EndDoc
       537 __imp_EndPage
       196 __imp_EndPaint
-        8 __imp_EnterCriticalSection
       12D __imp_EnumCalendarInfoW
       3E3 __imp_EnumClipboardFormats
       12F __imp_EnumDateFormatsW
@@ -1785,7 +1775,6 @@
       558 __imp_GetScrollInfo
       16F __imp_GetServiceByIndex
       174 __imp_GetServiceHandle
-      5CB __imp_GetStdioPathW
       505 __imp_GetStockObject
       102 __imp_GetStoreInformation
       139 __imp_GetStringTypeExW
@@ -1947,7 +1936,6 @@
       4C0 __imp_InSendMessage
        A5 __imp_InflateRect
         D __imp_InitLocale
-        6 __imp_InitializeCriticalSection
       38C __imp_InputDebugCharW
       4A1 __imp_InsertMenuW
       349 __imp_Int_CloseHandle
@@ -2005,7 +1993,6 @@
       4C6 __imp_KillTimer
       126 __imp_LCMapStringW
       38E __imp_LeaveCritSec
-        9 __imp_LeaveCriticalSection
       525 __imp_LineTo
        A2 __imp_LoadAcceleratorsW
       41E __imp_LoadAnimatedCursor
@@ -2317,7 +2304,6 @@
       555 __imp_SetScrollInfo
       556 __imp_SetScrollPos
       557 __imp_SetScrollRange
-      5CC __imp_SetStdioPathW
       4D7 __imp_SetSysColors
       135 __imp_SetSystemDefaultLCID
       17D __imp_SetSystemMemoryDivision
@@ -2443,7 +2429,6 @@
       4BD __imp_TranslateMessage
        BC __imp_TransmitCommChar
       4F5 __imp_TransparentImage
-      355 __imp_TryEnterCriticalSection
       3A6 __imp_TurnOffProfiling
       3A5 __imp_TurnOnProfiling
       36C __imp_U_rclose
@@ -3414,8 +3399,9 @@
 
 
 //function ChangeDisplaySettingsEx(lpszDeviceName: LPCTSTR; lpDevMode: LPDEVMODE; hwnd: HWND; dwflags: DWORD ; lParam: LPVOID ): LONG; external KernelDLL name 'ChangeDisplaySettingsEx';
-
-
+function GetStdioPathW(id: DWORD ; pwszBuf:LPWSTR ; lpdwLen:LPDWORD):WINBOOL; external KernelDLL name 'GetStdioPathW';
+function MapPtrToProcess(lpv: LPVOID; hProc: HANDLE ): LPVOID; external KernelDLL name 'MapPtrToProcess';
+function SetStdioPathW(id: DWORD; pwszPath: LPWSTR ):WINBOOL; external KernelDLL name 'SetStdioPathW';
 {$endif read_interface}
 
 

+ 15 - 16
rtl/wince/wininc/redef.inc

@@ -142,22 +142,25 @@ function LOCALE_NEUTRAL: DWORD;                                   //winnt
 function LOCALE_INVARIANT: DWORD;                                 //winnt
 
 
-function GetVersionExW(var lpVersionInformation: TOSVersionInfoW): BOOL; external KernelDLL name 'GetVersionExW';
-procedure GetLocalTime(var SystemTime: SYSTEMTIME); external KernelDLL name 'GetLocalTime';
-function SetLocalTime(var lpSystemTime:SYSTEMTIME):WINBOOL; external KernelDLL name 'SetLocalTime';
 function CreateProcessW(lpApplicationName: LPWSTR; lpCommandLine: LPWSTR; lpProcessAttributes, lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer; lpCurrentDirectory: LPWSTR;
   const lpStartupInfo: TStartupInfo; var lpProcessInformation: TProcessInformation): BOOL; external KernelDLL name 'CreateProcessW';
-function GetExitCodeProcess(hProcess: THandle; var lpExitCode: DWORD): BOOL; external KernelDLL name 'GetExitCodeProcess';
-function ReadFile(hFile: THandle; var Buffer; nNumberOfBytesToRead: DWORD; var lpNumberOfBytesRead: DWORD; lpOverlapped: POverlapped): BOOL; external KernelDLL name 'ReadFile';
-function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; external KernelDLL name 'WriteFile';
-function SetFileTime(hFile:HANDLE; var lpCreationTime:FILETIME; var lpLastAccessTime:FILETIME; var lpLastWriteTime:FILETIME):WINBOOL; external KernelDLL name 'SetFileTime';
+procedure DeleteCriticalSection(var CriticalSection : TRTLCriticalSection); external KernelDLL name 'DeleteCriticalSection';
 procedure EnterCriticalSection(var CriticalSection : TRTLCriticalSection); external KernelDLL name 'EnterCriticalSection';
+function GetExitCodeProcess(hProcess: THandle; var lpExitCode: DWORD): BOOL; external KernelDLL name 'GetExitCodeProcess';
+function GetExitCodeThread(hThread: THandle; var lpExitCode: DWORD): BOOL; external KernelDLL name 'GetExitCodeThread';
+procedure GetLocalTime(var SystemTime: SYSTEMTIME); external KernelDLL name 'GetLocalTime';
+function GetVersionExW(var lpVersionInformation: TOSVersionInfoW): BOOL; external KernelDLL name 'GetVersionExW';
+procedure InitializeCriticalSection(var CriticalSection : TRTLCriticalSection); external KernelDLL name 'InitializeCriticalSection';
 procedure LeaveCriticalSection(var CriticalSection : TRTLCriticalSection); external KernelDLL name 'LeaveCriticalSection';
-function RegisterClassW(const lpWndClass: TWndClassW): ATOM; external UserDLLCore name 'RegisterClassW';
 //redirected to MsgWaitForMultipleObjectsEx
 function MsgWaitForMultipleObjects(nCount: DWORD; var pHandles; fWaitAll: BOOL; dwMilliseconds, dwWakeMask: DWORD): DWORD;
 function PeekMessageW(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external UserDLLCore name 'PeekMessageW';
-function GetExitCodeThread(hThread: THandle; var lpExitCode: DWORD): BOOL; external KernelDLL name 'GetExitCodeThread';
+function ReadFile(hFile: THandle; var Buffer; nNumberOfBytesToRead: DWORD; var lpNumberOfBytesRead: DWORD; lpOverlapped: POverlapped): BOOL; external KernelDLL name 'ReadFile';
+function RegisterClassW(const lpWndClass: TWndClassW): ATOM; external UserDLLCore name 'RegisterClassW';
+function SetFileTime(hFile:HANDLE; var lpCreationTime:FILETIME; var lpLastAccessTime:FILETIME; var lpLastWriteTime:FILETIME):WINBOOL; external KernelDLL name 'SetFileTime';
+function SetLocalTime(var lpSystemTime:SYSTEMTIME):WINBOOL; external KernelDLL name 'SetLocalTime';
+function TryEnterCriticalSection(var CriticalSection : TRTLCriticalSection) : BOOL; external KernelDLL name 'TryEnterCriticalSection';
+function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; external KernelDLL name 'WriteFile';
 //end common win32 & wince
 
 {$ifdef WINCE}
@@ -174,9 +177,11 @@ function PeekMessage(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax,
 
 {$ifdef WIN32}
 //begin win32 only ie not exist in wince4.2 second release lib imported functions from dlls
-function GetVersionExA(var lpVersionInformation: TOSVersionInfo): BOOL; external 'kernel32' name 'GetVersionExA';
 function CreateProcessA(lpApplicationName: LPCSTR; lpCommandLine: LPCSTR; lpProcessAttributes, lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer; lpCurrentDirectory: LPCSTR;
   const lpStartupInfo: TStartupInfo; var lpProcessInformation: TProcessInformation): BOOL; external 'kernel32' name 'CreateProcessA';
+function GetVersionExA(var lpVersionInformation: TOSVersionInfo): BOOL; external 'kernel32' name 'GetVersionExA';
+function InitializeCriticalSectionAndSpinCount(var CriticalSection : TRTLCriticalSection;dwSpinCount : DWORD) : BOOL; external 'kernel32' name 'InitializeCriticalSectionAndSpinCount';
+function SetCriticalSectionSpinCount(var CriticalSection : TRTLCriticalSection;dwSpinCount : DWORD ): DWORD; external 'kernel32' name 'SetCriticalSectionSpinCount';
 //end win32 only
 {$endif WIN32}
 
@@ -221,12 +226,6 @@ function MakeResult(p1,p2,mask : Longint) : HRESULT;
 function HResultFromWin32(x : Longint) : HRESULT;
 function HResultFromNT(x : Longint) : HRESULT;
 
-procedure InitializeCriticalSection(var CriticalSection : TRTLCriticalSection); external 'kernel32' name 'InitializeCriticalSection';
-procedure DeleteCriticalSection(var CriticalSection : TRTLCriticalSection); external 'kernel32' name 'DeleteCriticalSection';
-function InitializeCriticalSectionAndSpinCount(var CriticalSection : TRTLCriticalSection;dwSpinCount : DWORD) : BOOL; external 'kernel32' name 'InitializeCriticalSectionAndSpinCount';
-function SetCriticalSectionSpinCount(var CriticalSection : TRTLCriticalSection;dwSpinCount : DWORD ): DWORD; external 'kernel32' name 'SetCriticalSectionSpinCount';
-function TryEnterCriticalSection(var CriticalSection : TRTLCriticalSection) : BOOL; external 'kernel32' name 'TryEnterCriticalSection';
-
 //function _lwrite(hFile: HFILE; const lpBuffer: LPCSTR; uBytes: UINT): UINT; external 'kernel32' name '_lwrite';
 //function AccessCheck(pSecurityDescriptor: PSecurityDescriptor; ClientToken: THandle; DesiredAccess: DWORD; const GenericMapping: TGenericMapping; var PrivilegeSet: TPrivilegeSet; var PrivilegeSetLength: DWORD; var GrantedAccess: DWORD;
 //  var AccessStatus: BOOL): BOOL; external 'advapi32' name 'AccessCheck';