2
0
Эх сурвалжийг харах

Merged revisions 12351,12369-12370 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r12351 | yury | 2008-12-12 16:03:07 +0200 (Пт, 12 дек 2008) | 1 line

* Added Delphi compatible definition for VerQueryValue for wince. Bug #12716.
........
r12369 | yury | 2008-12-16 13:32:48 +0200 (Вт, 16 дек 2008) | 1 line

+ Added sip and projects wince api units by Vasil Maximov.
........
r12370 | yury | 2008-12-16 13:40:45 +0200 (Вт, 16 дек 2008) | 1 line

+ Added wap wince api unit by AnarchyMob.
........

git-svn-id: branches/fixes_2_2@12375 -

yury 16 жил өмнө
parent
commit
a70989cd44

+ 3 - 0
.gitattributes

@@ -4430,6 +4430,7 @@ packages/winceunits/src/oleauto.pp svneol=native#text/plain
 packages/winceunits/src/phone.pp svneol=native#text/plain
 packages/winceunits/src/pm.pp svneol=native#text/plain
 packages/winceunits/src/power.pp svneol=native#text/plain
+packages/winceunits/src/projects.pp svneol=native#text/plain
 packages/winceunits/src/rapi.pp svneol=native#text/plain
 packages/winceunits/src/ras.pp svneol=native#text/plain
 packages/winceunits/src/raserror.pp svneol=native#text/plain
@@ -4437,10 +4438,12 @@ packages/winceunits/src/ril.pp svneol=native#text/plain
 packages/winceunits/src/service.pp svneol=native#text/plain
 packages/winceunits/src/shellapi.pp svneol=native#text/plain
 packages/winceunits/src/simmgr.pp svneol=native#text/plain
+packages/winceunits/src/sip.pp svneol=native#text/plain
 packages/winceunits/src/sipapi.pp svneol=native#text/plain
 packages/winceunits/src/sms.pp svneol=native#text/plain
 packages/winceunits/src/tapi.pp svneol=native#text/plain
 packages/winceunits/src/todaycmn.pp svneol=native#text/plain
+packages/winceunits/src/wap.pp svneol=native#text/plain
 packages/winceunits/src/windbase.pp svneol=native#text/plain
 packages/winceunits/src/windbase_edb.inc svneol=native#text/plain
 packages/winceunits/src/wininet.pp svneol=native#text/plain

+ 2 - 2
packages/winceunits/Makefile

@@ -274,10 +274,10 @@ ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_UNITS+=buildwinceunits
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror
+override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects wap
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror
+override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects wap
 endif
 override INSTALL_BUILDUNIT=buildwinceunits
 override INSTALL_FPCPACKAGE=y

+ 2 - 1
packages/winceunits/Makefile.fpc

@@ -11,7 +11,8 @@ units_wince=buildwinceunits
 implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi \
                     gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
                     sipapi cpl bt_api bt_sdp bthapi bthutil ril sms ws2bth keybd nled \
-                    phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror
+                    phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror \
+                    sip projects wap
 units_win32=rapi cesync
 
 [install]

+ 1 - 1
packages/winceunits/src/buildwinceunits.pp

@@ -25,7 +25,7 @@ uses
   gpsapi,todaycmn,windbase,cesync,gx,winioctl,msgqueue,pm,service,htmlctrl,
   sipapi, cpl, bt_api, bt_sdp, bthapi, bthutil, ril, sms, ws2bth,
   keybd, nled, phone, connmgr, devload, devmgmt, mmreg, mmsystem, msacm,
-  wininet, ras, raserror;
+  wininet, ras, raserror, sip, projects, wap;
 
 implementation
 

+ 345 - 0
packages/winceunits/src/projects.pp

@@ -0,0 +1,345 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+//  File: project.h
+//
+//  Abstract:
+//
+//  Contents:
+//    Project APIs defines
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit projects;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+const
+      Note_prjDLL = 'note_prj.dll';
+
+type
+     tagENUM = (PRJ_ENUM_MEMORY		    := $01,	// enumerate main memory projects only
+	               PRJ_ENUM_FLASH		     := $02,	// enumerate flash card projects only
+	               PRJ_ENUM_ALL_DEVICES := $04,	// enumerate main memory projects & Flash card,
+	               PRJ_ENUM_ALL_PROJ	   := $10,	// enumerate in all projects
+	               PRJ_ENUM_HOME_PROJ	  := $0100 // add 'My Documents' home folder
+               );
+     PRJ_ENUM = tagENUM;
+
+
+//////////////////////////////////////////////////////////////////////////////
+// THE "OID" PROBLEM
+//
+// The OS changed from returning faked OIDs for
+// storage cards and other FAT file systems to returning invalid / -1.  This
+// seriously messes up anything that wants to uses OIDs to identify objects
+// on a storage card.
+//
+
+type
+     PFNCOLCUSTOK = function(iParam1:HWND; iParam2:LPVOID):BOOL; cdecl;
+     PROJECTS_ENUMPROC = function(iParam1:DWORD; iParam2:LPARAM):BOOL; cdecl;
+     PROJECTSFILES_ENUMPROC = function(idwOID:DWORD; ilParam:LPARAM):BOOL; cdecl;
+
+
+{*****************************************************************************
+EnumProjects	Exported API: Enumerates all projects on the specified file
+				system.
+
+
+PARAMETERS:
+pfnEnumProc	pointer to callback function. If NULL, this function simply
+			returns the number of projects, without enumerating through them.
+			If the callback function ever returns FALSE, the enumeration will
+			halt.  The callback has the following prototype:
+			BOOL CALLBACK EnumProjectsCallback(DWORD dwOid, LPARAM lParam);
+
+dwOidFlash	Only used for (dwFlags == PRJ_ENUM_FLASH).  This is the OID of
+			the flash card to look at; the value returned by
+			FindFirstFlashCard or FindNextFlashCard.
+
+dwFlags
+			Any combo of the following (specifying the LOCATION to check):
+			PRJ_ENUM_MEMORY - check all main memory projects/folders,
+							  dwOidFlash is not used
+			PRJ_ENUM_FLASH  - check all projects on the specified flash card,
+							  where dwOidFlash specifies the flash card to
+							  examine.
+			PRJ_ENUM_ALL_DEVICES - check all projects/folders from main memory,
+							  and from *every* flash card.  (dwOid is not used)
+
+lParam		user defined parameter passed to pfnEnumProc
+
+
+RETURN:
+The total number of projects.  NOTE: this is actually the total number of
+projects in MAIN MEMORY ONLY (see below).
+
+
+THIS IS PROVIDED FOR BACKWARD COMPATIBILITY.  It will silently skip over any
+project that isn't on an OID-based filesystem (it enumerates everything in
+main memory, but will silently skip everything on storage cards).  The modern
+function is EnumProjectsEx.
+******************************************************************************}
+
+function EnumProjects(lpEnumProc:PROJECTS_ENUMPROC; dwOid:DWORD; dwFlags:DWORD; lParam:LPARAM):longint; external Note_prjDLL name 'EnumProjects';
+
+{*****************************************************************************
+EnumProjectsFiles	Exported API: Enumaretes all files in a project on the
+					specified file system.
+
+PARAMETERS:
+pfnEnumProc	pointer to callback function. If NULL, this function simply
+			returns the number of files without enumerating through them.
+			If the callback function ever returns FALSE, the enumeration will
+			halt.  The callback has the following prototype:
+ (normal)	BOOL CALLBACK EnumProjectFilesCallback(DWORD dwOID, LPARAM lParam);
+ (ex ver)	BOOL CALLBACK EnumProjectFilesExCallback(PAstruct* pPA, LPARAM lParam);
+
+dwOidFlash	Only used for (dwFlags & PRJ_ENUM_FLASH).  This is the OID of
+			the flash card to look at; the value returned by
+			FindFirstFlashCard or FindNextFlashCard.
+
+dwFlags	
+			Any combo of the following (specifying the LOCATION to check):
+			PRJ_ENUM_MEMORY - check all main memory projects/folders,
+							  dwOidFlash is not used
+			PRJ_ENUM_FLASH  - check all projects on the specified flash card,
+							  where dwOidFlash specifies the flash card to
+							  examine.
+			PRJ_ENUM_ALL_DEVICES - check all projects/folders from main memory,
+							  and from *every* flash card.  (dwOid is not used)
+
+			Plus any of the following (specifying which PROJECTS to check):
+			PRJ_ENUM_ALL_PROJ- enumerate in all project (szProj is not used)
+
+szProj		Only used for when (dwFlags & PRJ_ENUM_ALL_PROJ) is NOT set.  This
+			specifies which project to search; NULL specifies to look for files
+			that aren't in a project/folder (i.e., they're at the top level,
+			under "\My Documents").
+
+szFileName	pointer to name of file to search for. (i.e. '*.wav' or '*.*')
+
+lParam		user defined parameter passed to pfnEnumProc 
+
+
+RETURN:
+The total number of matching files found.  NOTE: in the regular version,
+this is actually the total number of files in MAIN MEMORY ONLY (see below).
+
+
+The regular version is provided for backward compatibility.  It will silently
+skip over any file that isn't on an OID-based filesystem (it enumerates
+everything in main memory, but will silently skip everything on storage cards).
+
+The modern version, EnumProjectsFilesEx, requires the extended callback
+function, too.
+******************************************************************************}
+function EnumProjectsFiles(lpEnumProc:PROJECTSFILES_ENUMPROC;
+                           dwOidFlash:DWORD;
+                           dwFlags:DWORD;
+                           lpszProj:LPTSTR;
+                           lpszFileName:LPTSTR;
+                           lParam:LPARAM):longint; external Note_prjDLL name 'EnumProjectsFiles';
+
+{**************************************************************************************************
+FindFirstFlashCard
+Find the first mountable file system
+	lpFindProjData -  pointer to returned information
+**************************************************************************************************}
+function FindFirstFlashCard(lpFindFlashData:LPWIN32_FIND_DATA):HANDLE; external Note_prjDLL name 'FindFirstFlashCard';
+
+{**************************************************************************************************
+FindNextFlashCard
+Find the next mountable file system
+	lpFindProjData	-  pointer to returned information
+	hFindFlash		- Identifies a search handle returned by a previous call to the FindFirstFlashCard function.
+**************************************************************************************************}
+function FindNextFlashCard(hFindFlash:HANDLE; lpFindFlashData:LPWIN32_FIND_DATA):BOOL; external Note_prjDLL name 'FindNextFlashCard';
+
+{**************************************************************************************************
+FindFirstProjectFile
+Find the first file in a project, on the desired mountable file system
+	lpFileName		- pointer to name of file to search for	(i.e: '*.wav')
+	lpFindFileData	- pointer to returned information
+	dwOidFlash		- Oid to the desired mountable file system (FindFirstFlashCard or FindNextFlashCard)
+					  or 0 if main memory
+	lpszProj		- desired project, or NULL (or 'All') to search for files that do not
+					  have a project (under '\My Documents')
+**************************************************************************************************}
+function FindFirstProjectFile(lpFileName:LPCTSTR;
+                              lpFindFileData:LPWIN32_FIND_DATA;
+                              dwOidFlash:DWORD;
+                              szProject:LPTSTR):HANDLE; external Note_prjDLL name 'FindFirstProjectFile';
+
+{**************************************************************************************************
+FindNextProjectFile
+Find the next file in a project
+	lpFindProjData	- pointer to returned information
+	hFind			- Identifies a search handle returned by a previous call to the FindFirstProjectFile function.
+**************************************************************************************************}
+function FindNextProjectFile(hFindFlash:HANDLE; lpFindFlashData:LPWIN32_FIND_DATA):BOOL; external Note_prjDLL name 'FindNextProjectFile';
+
+// new code, it solves the "OID Problem"
+
+//////////////////////////////////////////////////////////////////////////////
+// PAstruct:
+// This is pretty much a drop-in replacement for the spot where OIDs are
+// currently used.  Instead of passing around a DWORD, we now pass a pointer
+// to this struct.  IMPORTANT: callers are responsible for allocating and
+// freeing the string memory for file paths.
+
+type
+     _EFileIDType = (FILE_ID_TYPE_OID	 := 0,	// This file is specified through an OID
+	                    FILE_ID_TYPE_PATH	:= 1,	// This file is specified through its pathname
+	                    FILE_ID_LAST		    := 2	 // last value in the list (invalid)
+                    );
+     EFileIDType = _EFileIDType;
+
+const
+      PA_MAX_PATHNAME = 96;		// including null terminator, practically speaking,
+                             // might be " \storage card 3\My Documents\document
+                             // folder 7\very long filename.wav" or 69 char's max
+
+// Pure-NT machines don't necessarily define CEOID.  In the future, we'll want
+// to replace this define with the actual typedef (JParks).
+{$IFNDEF CEOID} // #ifndef CEOID
+type
+     CEOID = DWORD;
+{$ENDIF CEOID} // #endif
+
+type
+     _PAstruct	= record	// "PA" (Pathname Array) OID-NUMBER REPLACEMENT STRUCTURE
+	      m_IDtype:EFileIDType;	// is this an OID or a pathname?
+       case longint of
+         0: (m_fileOID:CEOID);	// we're storing the OID
+		       1: (m_szPathname:array[0..PA_MAX_PATHNAME-1] of TCHAR);	// we're storing the full pathname\filename
+     end;
+     PAstruct = _PAstruct;
+     PPAstruct = ^_PAstruct;
+
+
+type
+     PROJECTS_ENUMPROC_EX =function(pPA:PPAstruct; lParam:LPARAM):BOOL; cdecl;
+     PROJECTSFILES_ENUMPROC_EX = function(pPA:PPAstruct; lParam:LPARAM):BOOL; cdecl;
+
+{*****************************************************************************
+EnumProjectsEx	Exported API: Enumerates all projects on the specified file
+				system.
+
+PARAMETERS:
+pfnEnumProc	pointer to callback function. If NULL, this function simply
+			returns the number of projects, without enumerating through them.
+			If the callback function ever returns FALSE, the enumeration will
+			halt.  The callback has the following prototype:
+			BOOL CALLBACK EnumProjectsExCallback(PAstruct* pPA, LPARAM lParam);
+
+dwOidFlash	Only used for (dwFlags == PRJ_ENUM_FLASH).  This is the OID of
+			the flash card to look at; the value returned by
+			FindFirstFlashCard or FindNextFlashCard.
+
+dwFlags
+			Any combo of the following (specifying the LOCATION to check):
+			PRJ_ENUM_MEMORY - check all main memory projects/folders,
+							  dwOidFlash is not used
+			PRJ_ENUM_FLASH  - check all projects on the specified flash card,
+							  where dwOidFlash specifies the flash card to
+							  examine.
+			PRJ_ENUM_ALL_DEVICES - check all projects/folders from main memory,
+							  and from *every* flash card.  (dwOid is not used)
+
+lParam		user defined parameter passed to pfnEnumProc
+
+
+RETURN:
+The total number of projects *including* storage cards.
+
+
+This enhanced version can enumerate through both new (OID-based) file systems
+and older (DOS-style) filesystems -- including storage cards.
+******************************************************************************}
+function EnumProjectsEx(pfnEnumProc:PROJECTS_ENUMPROC_EX;
+                        dwOidFlash:DWORD;
+                        dwFlags:DWORD;
+                        lParam:LPARAM):longint; external Note_prjDLL name 'EnumProjectsEx';
+
+
+{*****************************************************************************
+EnumProjectsFiles	Exported API: Enumaretes all files in a project on the
+					specified file system.
+
+PARAMETERS:
+pfnEnumProc	pointer to callback function. If NULL, this function simply
+			returns the number of files without enumerating through them.
+			If the callback function ever returns FALSE, the enumeration will
+			halt.  The callback has the following prototype:
+ (normal)	BOOL CALLBACK EnumProjectFilesCallback(DWORD dwOID, LPARAM lParam);
+ (ex ver)	BOOL CALLBACK EnumProjectFilesExCallback(PAstruct* pPA, LPARAM lParam);
+
+dwOidFlash	Only used for (dwFlags & PRJ_ENUM_FLASH).  This is the OID of
+			the flash card to look at; the value returned by
+			FindFirstFlashCard or FindNextFlashCard.
+
+dwFlags
+			Any combo of the following (specifying the LOCATION to check):
+			PRJ_ENUM_MEMORY - check all main memory projects/folders,
+							  dwOidFlash is not used
+			PRJ_ENUM_FLASH  - check all projects on the specified flash card,
+							  where dwOidFlash specifies the flash card to
+							  examine.
+			PRJ_ENUM_ALL_DEVICES - check all projects/folders from main memory,
+							  and from *every* flash card.  (dwOid is not used)
+
+			Plus any of the following (specifying which PROJECTS to check):
+			PRJ_ENUM_ALL_PROJ- enumerate in all project (szProj is not used)
+
+szProj		Only used for when (dwFlags & PRJ_ENUM_ALL_PROJ) is NOT set.  This
+			specifies which project to search; NULL specifies to look for files
+			that aren't in a project/folder (i.e., they're at the top level,
+			under "\My Documents").
+
+szFileName	pointer to name of file to search for. (i.e. '*.wav' or '*.*')
+
+lParam		user defined parameter passed to pfnEnumProc
+
+
+RETURN:
+The total number of matching files found.  NOTE: in the regular version,
+this is actually the total number of files in MAIN MEMORY ONLY (see below).
+
+
+The regular version is provided for backward compatibility.  It will silently
+skip over any file that isn't on an OID-based filesystem (it enumerates
+everything in main memory, but will silently skip everything on storage cards).
+
+The modern version, EnumProjectsFilesEx, requires the extended callback
+function, too.
+******************************************************************************}
+function EnumProjectsFilesEx(pfnEnumProc:PROJECTSFILES_ENUMPROC_EX;
+                             dwOidFlash:DWORD;
+                             dwFlags:DWORD;
+                             szProj:LPTSTR;
+                             szFileName:LPTSTR;
+                             lParam:LPARAM):longint; external Note_prjDLL name 'EnumProjectsFilesEx';
+
+implementation
+
+end.

+ 123 - 0
packages/winceunits/src/sip.pp

@@ -0,0 +1,123 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit sip;
+
+interface
+
+{$MODE OBJFPC}
+
+uses Windows, Types, SIPAPI;
+
+const
+      IID_IIMCallback:TIID    = '{42429669-AE04-11D0-A4F8-00AA00A749B9}';
+      IID_IIMCallback2:TIID   = '{0576F2E0-AA6B-11D2-A146-0000F8757270}';
+      IID_IIMCallbackEx:TIID  = '{9DDB3920-3606-11D2-A2EB-0000F8757270}';
+      IID_IInputMethod:TIID   = '{42429666-AE04-11D0-A4F8-00AA00A749B9}';
+      IID_IInputMethodEx:TIID = '{9DDB3921-3606-11D2-A2EB-0000F8757270}';
+      IID_IInputMethod2:TIID  = '{0576F2E1-AA6B-11D2-A146-0000F8757270}';
+
+const
+      CLSID_CMSQwertyIm:CLSID = '{42429667-AE04-11D0-A4f8-00AA00A749B9}';
+
+type
+     _tagImInfo = record
+       cbSize:DWORD;
+       hImageNarrow:HANDLE;
+       hImageWide:HANDLE;
+       iNarrow:longint;
+       iWide:longint;
+       fdwFlags:DWORD;
+       rcSipRect:Windows.RECT;
+     end;
+     IMINFO = _tagImInfo;
+     LPIMINFO = ^_tagImInfo;
+
+type
+     _tagLMDATA = record
+       dwVersion:DWORD;
+       flags:DWORD;
+       cnt:DWORD;
+       dwOffsetSymbols:DWORD;
+       dwOffsetSkip:DWORD;
+       dwOffsetScore:DWORD;
+       ab:array[0..0] of byte; //* [max_is] */
+     end;
+     LMDATA = _tagLMDATA;
+     LPLMDATA = ^_tagLMDATA;
+
+type
+    IIMCallback = interface(IUnknown)
+     ['{42429669-AE04-11D0-A4F8-00AA00A749B9}']
+      function SetImInfo(pimi:LPIMINFO):HRESULT; stdcall;
+      function SendVirtualKey(bVK:byte; dwFlags:DWORD):HRESULT; stdcall;
+      function SendCharEvents(uVK:UINT; uKeyFlags:UINT; uChars:UINT; puShift:PUINT; puChars:PUINT):HRESULT; stdcall;
+      function SendString(ptszStr:POleStr{BSTR}; dwChars:DWORD):HRESULT; stdcall;
+    end;
+
+    IIMCallback2 = interface(IIMCallback)
+     ['{0576F2E0-AA6B-11D2-A146-0000F8757270}']
+      function SendAlternatives2(plmd:LMDATA):HRESULT; stdcall;
+    end;
+
+    IIMCallbackEx = interface(IIMCallback)
+     ['{9DDB3920-3606-11D2-A2EB-0000F8757270}']
+      function SendAlternatives(plmd:LPLMDATA):HRESULT; stdcall;
+    end;
+
+    IInputMethod = interface(IUnknown)
+     ['{42429666-AE04-11D0-A4F8-00AA00A749B9}']
+      function Select(hwndSip:HWND):HRESULT; stdcall;
+      function Deselect:HRESULT; stdcall;
+      function Showing:HRESULT; stdcall;
+      function Hiding:HRESULT; stdcall;
+      function GetInfo(pimi:LPIMINFO):HRESULT; stdcall;
+      function ReceiveSipInfo(psi:LPSIPINFO):HRESULT; stdcall;
+      function RegisterCallback(const lpIMCallback:IIMCallback):HRESULT; stdcall;
+      function GetImData(dwSize:DWORD; pvImData:LPVOID):HRESULT; stdcall;
+      function SetImData(dwSize:DWORD; pvImData:LPVOID):HRESULT; stdcall;
+      function UserOptionsDlg(hwndParent:HWND):HRESULT; stdcall;
+    end;
+
+    IInputMethodEx = interface(IInputMethod)
+     ['{9DDB3921-3606-11D2-A2EB-0000F8757270}']
+      function SetIMMActiveContext(_hwnd:HWND;
+                                   bOpen:BOOL;
+                                   dwConversion:DWORD;
+                                   dwSentence:DWORD;
+                                   hkl:DWORD):HRESULT; stdcall;
+      function RegisterCallbackEx(const lpIMCallback:IIMCallbackEx):HRESULT; stdcall;
+    end;
+
+
+    IInputMethod2 = interface(IInputMethod)
+     ['{0576F2E1-AA6B-11D2-A146-0000F8757270}']
+      function SetIMMActiveContext(_hwnd:HWND;
+                                   bOpen:BOOL;
+                                   dwConversion:DWORD;
+                                   dwSentence:DWORD;
+                                   hkl:DWORD):HRESULT; stdcall;
+      function RegisterCallback2(const lpIMCallback:IIMCallback2):HRESULT; stdcall;
+    end;
+
+
+
+implementation
+
+end.

+ 239 - 0
packages/winceunits/src/wap.pp

@@ -0,0 +1,239 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+unit wap;
+
+interface
+
+uses
+  Windows;
+  
+{$calling cdecl}
+
+//*********************************************************
+//
+// Constants
+//
+//*********************************************************
+
+const
+  wapdll                 = 'wap.dll';
+  //*******************************************************
+  FACILITY_WAP           = $500;
+  //WTLS errors
+  WAP_E_WTLS             = (SEVERITY_ERROR shl 31) or (FACILITY_WAP shl 16) or $0001;
+  WAP_E_WTLS_CERTIFICATE = (SEVERITY_ERROR shl 31) or (FACILITY_WAP shl 16) or $0002;
+  WAP_E_WTLS_HANDSHAKE   = (SEVERITY_ERROR shl 31) or (FACILITY_WAP shl 16) or $0003;
+  WAP_E_WTLS_CRYPTERROR  = (SEVERITY_ERROR shl 31) or (FACILITY_WAP shl 16) or $0004;
+  WAP_E_WTLS_BADMAC      = (SEVERITY_ERROR shl 31) or (FACILITY_WAP shl 16) or $0005;
+  WAP_E_NO_UDP_ACCESS    = (SEVERITY_ERROR shl 31) or (FACILITY_WAP shl 16) or $00100;
+
+//Maximum sizes
+const
+  MAX_WAP_ADDRESS_LENGTH             = 64;
+//WDP field identifiers
+  WDP_FIELD_NONE                     = $00000000;
+  WDP_FIELD_SOURCEADDRESS            = $00000001;
+  WDP_FIELD_SOURCEPORT               = $00000002;
+  WDP_FIELD_DESTINATIONADDRESS       = $00000004;
+  WDP_FIELD_DESTINATIONPORT          = $00000008;
+  WDP_FIELD_USERDATA                 = $00000010;
+  WDP_FIELD_ERRORCODE                = $00000020;
+//WTP field identifiers
+  WTP_FIELD_NONE                     = $00000000;
+  WTP_FIELD_SOURCEADDRESS            = $00000001;
+  WTP_FIELD_SOURCEPORT               = $00000002;
+  WTP_FIELD_DESTINATIONADDRESS       = $00000004;
+  WTP_FIELD_DESTINATIONPORT          = $00000008;
+  WTP_FIELD_USERACKNOWLEDGEMENT      = $00000010;
+  WTP_FIELD_WANTSECURETRANSACTION    = $00000020;
+  WTP_FIELD_USERDATA                 = $00000040;
+  WTP_FIELD_CLASSTYPE                = $00000080;
+  WTP_FIELD_EXITINFO                 = $00000100;
+  WTP_FIELD_HANDLE                   = $00000200;
+  WTP_FIELD_ABORTCODE                = $00000400;
+  WTP_FIELD_TRANSACTIONSECURITYLEVEL = $00000800;
+  INVALID_WTP_TRANSACTION_HANDLE     = 0;
+
+//****************************************************************
+//
+// Types
+//
+//****************************************************************
+
+type
+  WAP_LAYER = (
+    WAP_LAYER_WDP = 1,
+    WAP_LAYER_WTLS, 
+    WAP_LAYER_WTP, 
+    WAP_LAYER_WSP, 
+    WAP_LAYER_WAE);
+  PWAP_LAYER = ^WAP_LAYER;
+
+//WAP primitives
+  WAP_PRIMITIVE_ID = (
+    WAP_PRIMITIVE_ID_T_DUNITDATA = 1);
+  PWAP_PRIMITIVE_ID = ^WAP_PRIMITIVE_ID;
+
+//WAP primitive type
+  WAP_PRIMITIVE_TYPE = (
+    WAP_PRIMITIVE_TYPE_REQUEST   = 1,
+    WAP_PRIMITIVE_TYPE_INDICATION, 
+    WAP_PRIMITIVE_TYPE_RESPONSE, 
+    WAP_PRIMITIVE_TYPE_CONFIRM);
+  PWAP_PRIMITIVE_TYPE = ^WAP_PRIMITIVE_TYPE;
+
+//WAP address types
+  WAP_ADDRESS_TYPE = (
+    WAP_ADDRESS_TYPE_UDP = 1,
+    WAP_ADDRESS_TYPE_GSM_SMS);
+  PWAP_ADDRESS_TYPE = ^WAP_ADDRESS_TYPE;
+
+//WAP address structure
+  WAP_ADDRESS_tag = record
+    watAddressType: WAP_ADDRESS_TYPE;
+    ptsAddress    : Array[0..MAX_WAP_ADDRESS_LENGTH-1] of TCHAR;
+  end {WAP_ADDRESS_tag};
+  WAP_ADDRESS  = WAP_ADDRESS_tag;
+  PWAP_ADDRESS = ^WAP_ADDRESS_tag;
+
+  WAP_HANDLE  = LongInt;
+  PWAP_HANDLE = ^WAP_HANDLE;
+
+//WTP transaction class types
+  WTP_TRANSACTION_CLASS_TYPE = (
+    WTP_TRANSACTION_CLASS_TYPE_0 = 1,
+    WTP_TRANSACTION_CLASS_TYPE_1, 
+    WTP_TRANSACTION_CLASS_TYPE_2);
+  PWTP_TRANSACTION_CLASS_TYPE = ^WTP_TRANSACTION_CLASS_TYPE;
+
+//WTP secure transaction (WTLS) security levels
+  WTP_TRANSACTION_SECURITY_LEVEL = (
+    WTP_TRANSACTION_SECURITY_LEVEL_NOTSECURE   = 1,
+    WTP_TRANSACTION_SECURITY_LEVEL_SECURENOAUTH, 
+    WTP_TRANSACTION_SECURITY_LEVEL_GATEWAYAUTH);
+  PWTP_TRANSACTION_SECURITY_LEVEL = ^WTP_TRANSACTION_SECURITY_LEVEL;
+
+  WTP_TRANSACTION_HANDLE = LongInt;
+
+//WAP primitives
+//Base primitive type - all other primitive types derive from this one
+  wap_primitive_base_tag = record
+    wpiPrimitiveID  : WAP_PRIMITIVE_ID;
+    wptPrimitiveType: WAP_PRIMITIVE_TYPE;
+    dwValidFields   : LongInt;
+  end {wap_primitive_base_tag};
+  WAP_PRIMITIVE_BASE  = wap_primitive_base_tag;
+  PWAP_PRIMITIVE_BASE = ^wap_primitive_base_tag;
+
+//T-DUnitdata primitive (WDP)
+  wdp_unitdata_tag = record
+    wpiPrimitiveID      : WAP_PRIMITIVE_ID;
+    wptPrimitiveType    : WAP_PRIMITIVE_TYPE;
+    dwValidFields       : LongInt;
+    waSourceAddress     : WAP_ADDRESS;
+    dwSourcePort        : LongInt;
+    waDestinationAddress: WAP_ADDRESS;
+    dwDestinationPort   : LongInt;
+    pbUserData          : PBYTE;
+    dwUserDataSize      : LongInt;
+  end {wdp_unitdata_tag};
+  WDP_INITDATA  = wdp_unitdata_tag;
+  PWDP_INITDATA = ^wdp_unitdata_tag;
+
+//T-DError primitive (WDP)
+//typedef struct wap_primitive_t_derror_tag
+//WAP_PRIMITIVE_ID wpiPrimitiveID;
+//WAP_PRIMITIVE_TYPE wptPrimitiveType;
+//DWORD dwValidFields;
+//WAP_ADDRESS waSourceAddress;
+//DWORD dwSourcePort;
+//WAP_ADDRESS waDestinationAddress;
+//DWORD dwDestinationPort;
+//HRESULT hrErrorCode;
+//WAP_PRIMITIVE_T_DERROR;
+//TR-Invoke primitive (WTP)
+
+  wtp_invoke_tag = record
+    wpiPrimitiveID        : WAP_PRIMITIVE_ID;
+    wptPrimitiveType      : WAP_PRIMITIVE_TYPE;
+    dwValidFields         : LongInt;
+    waSourceAddress       : WAP_ADDRESS;
+    dwSourcePort          : LongInt;
+    waDestinationAddress  : WAP_ADDRESS;
+    dwDestinationPort     : LongInt;
+    bUserAcknowledgement  : Bool;
+    bWantSecureTransaction: Bool;
+    pbUserData            : PBYTE;
+    dwUserDataSize        : LongInt;
+    wtctClassType         : WTP_TRANSACTION_CLASS_TYPE;
+    pbExitInfo            : PBYTE;
+    dwExitInfoSize        : LongInt;
+    wthTransactionHandle  : WTP_TRANSACTION_HANDLE;
+  end {wtp_invoke_tag};
+  WTP_INVOKE  = wtp_invoke_tag;
+  PWTP_INVOKE = ^wtp_invoke_tag;
+
+//TR-Result primitive (WTP)
+  wtp_result_tag = record
+    wpiPrimitiveID              : WAP_PRIMITIVE_ID;
+    wptPrimitiveType            : WAP_PRIMITIVE_TYPE;
+    dwValidFields               : LongInt;
+    pbUserData                  : PBYTE;
+    dwUserDataSize              : LongInt;
+    pbExitInfo                  : PBYTE;
+    dwExitInfoSize              : LongInt;
+    wthTransactionHandle        : WTP_TRANSACTION_HANDLE ;
+    wtslTransactionSecurityLevel: WTP_TRANSACTION_SECURITY_LEVEL;
+  end {wtp_result_tag};
+  WTP_RESULT  = wtp_result_tag;
+  PWTP_RESULT = ^wtp_result_tag;
+
+//TR-Abort primitive (WTP)
+  wtp_abort_tag = record
+    wpiPrimitiveID      : WAP_PRIMITIVE_ID;
+    wptPrimitiveType    : WAP_PRIMITIVE_TYPE;
+    dwValidFields       : LongInt;
+    bAbortCode          : BYTE;
+    wthTransactionHandle: WTP_TRANSACTION_HANDLE ;
+  end {wtp_abort_tag};
+  WTP_ABORT  = wtp_abort_tag;
+  PWTP_ABORT = ^wtp_abort_tag;
+
+//************************************************************
+//
+// WinAPI functions
+//
+//************************************************************
+
+function WapOpen(const wlLayer: WAP_LAYER;
+                 const dwLocalPort: LongInt;
+                 const pwhHandle: PWAP_HANDLE;
+                 const phMessageAvailableEvent: PHandle): HRESULT; external wapdll name 'WapOpen';
+function WapClose(const whHandle: WAP_HANDLE): HRESULT; external wapdll name 'WapClose';
+function WapSend(const whHandle: WAP_HANDLE;
+                 const pwpbPrimitive: PWAP_PRIMITIVE_BASE): HRESULT; external wapdll name 'WapSend';
+function WapGetNextPrimitiveSize(const whHandle: WAP_HANDLE;
+                                 const pdwNextPrimitiveSize: PLongInt): HRESULT; external wapdll name 'WapGetNextPrimitiveSize';
+function WapRead(const whHandle: WAP_HANDLE;
+                 const pwpbPrimitiveBuffer: WAP_PRIMITIVE_BASE;
+                 const dwPrimitiveBufferSize: LongInt): HRESULT; external wapdll name 'WapRead';
+function WapPing(const pwaAddress: PWAP_ADDRESS;
+                 const wIdentifier: Word;
+                 const dwSendDataSize: LongInt;
+                 const pdwReceiveDataSize: PLongInt;
+                 const dwTimeout: LongInt): HRESULT; external wapdll name 'WapPing';
+
+implementation
+
+end.

+ 4 - 4
rtl/wince/wininc/coredll.inc

@@ -2895,10 +2895,10 @@ function UpdateWindow(hWnd:HWND):WINBOOL; external KernelDLL name 'UpdateWindow'
 function ValidateRect(hWnd:HWND; const lpRect:RECT):WINBOOL; external KernelDLL name 'ValidateRect';
 function ValidateRect(hWnd:HWND;lpRect:LPRECT):WINBOOL; external KernelDLL name 'ValidateRect';
 function ValidateRgn(hWnd:HWND; hRgn:HRGN):WINBOOL; external KernelDLL name 'ValidateRgn';
-function VerQueryValue(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:LPVOID; puLen:PUINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
-function VerQueryValue(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:LPVOID; var puLen:UINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
-function VerQueryValueW(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:LPVOID; puLen:PUINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
-function VerQueryValueW(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:LPVOID; var uLen:UINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
+function VerQueryValue(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:PPVOID; puLen:PUINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
+function VerQueryValue(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:PPVOID; var puLen:UINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
+function VerQueryValueW(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:PPVOID; puLen:PUINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
+function VerQueryValueW(pBlock:LPVOID; lpSubBlock:LPWSTR; lplpBuffer:PPVOID; var uLen:UINT):WINBOOL; external KernelDLL name 'VerQueryValueW';
 function VirtualAlloc(lpAddress:LPVOID; dwSize:DWORD; flAllocationType:DWORD; flProtect:DWORD):LPVOID; external KernelDLL name 'VirtualAlloc';
 function VirtualFree(lpAddress:LPVOID; dwSize:DWORD; dwFreeType:DWORD):WINBOOL; external KernelDLL name 'VirtualFree';
 function VirtualQuery(lpAddress:LPCVOID; lpBuffer:PMEMORY_BASIC_INFORMATION; dwLength:DWORD):DWORD; external KernelDLL name 'VirtualQuery';

+ 2 - 0
rtl/wince/wininc/redef.inc

@@ -288,6 +288,8 @@ function TranslateCharsetInfo(var lpSrc: DWORD; var lpCs: TCharsetInfo; dwFlags:
 function TranslateMessage(const lpMsg: TMsg): BOOL; external KernelDLL name 'TranslateMessage';
 function TryEnterCriticalSection(var CriticalSection : TRTLCriticalSection) : BOOL; external KernelDLL name 'TryEnterCriticalSection';
 function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): BOOL; external KernelDLL name 'UnionRect';
+function VerQueryValue(pBlock: Pointer; lpSubBlock: LPWSTR; var lplpBuffer: Pointer; var uLen: UINT): BOOL; external KernelDLL name 'VerQueryValueW';
+function VerQueryValueW(pBlock: Pointer; lpSubBlock: LPWSTR; var lplpBuffer: Pointer; var uLen: UINT): BOOL; external KernelDLL name 'VerQueryValueW';
 function VirtualProtect(lpAddress:LPVOID; dwSize:DWORD; flNewProtect:DWORD; var lpflOldProtect:DWORD):WINBOOL; external KernelDLL name 'VirtualProtect';
 function VirtualQuery(lpAddress: Pointer; var lpBuffer: TMemoryBasicInformation; dwLength: DWORD): DWORD; external KernelDLL name 'VirtualQuery';
 function WaitCommEvent(hFile: THandle; var lpEvtMask: DWORD; lpOverlapped: POverlapped): BOOL; external KernelDLL name 'WaitCommEvent';