Browse Source

+ Added sip and projects wince api units by Vasil Maximov.

git-svn-id: trunk@12369 -
yury 16 years ago
parent
commit
9e19ef3a2c

+ 2 - 0
.gitattributes

@@ -4635,6 +4635,7 @@ packages/winceunits/src/phone.pp svneol=native#text/plain
 packages/winceunits/src/pimstore.pp svneol=native#text/plain
 packages/winceunits/src/pimstore.pp svneol=native#text/plain
 packages/winceunits/src/pm.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/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/rapi.pp svneol=native#text/plain
 packages/winceunits/src/ras.pp svneol=native#text/plain
 packages/winceunits/src/ras.pp svneol=native#text/plain
 packages/winceunits/src/raserror.pp svneol=native#text/plain
 packages/winceunits/src/raserror.pp svneol=native#text/plain
@@ -4642,6 +4643,7 @@ packages/winceunits/src/ril.pp svneol=native#text/plain
 packages/winceunits/src/service.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/shellapi.pp svneol=native#text/plain
 packages/winceunits/src/simmgr.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/sipapi.pp svneol=native#text/plain
 packages/winceunits/src/sms.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/tapi.pp svneol=native#text/plain

+ 3 - 3
packages/winceunits/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/12/12]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/12/16]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -275,10 +275,10 @@ ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_UNITS+=comobj buildwinceunits
 override TARGET_UNITS+=comobj buildwinceunits
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 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 pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror activex ole2 comconst
+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 pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects activex ole2 comconst
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 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 pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror activex ole2 comconst
+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 pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects activex ole2 comconst
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=comconst
 override TARGET_RSTS+=comconst

+ 1 - 0
packages/winceunits/Makefile.fpc

@@ -12,6 +12,7 @@ implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shel
                     gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
                     gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
                     sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled \
                     sipapi cpl bt_api bt_sdp bthapi bthutil pimstore 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 \
                     activex ole2 comconst
                     activex ole2 comconst
 
 
 units_win32=rapi cesync
 units_win32=rapi cesync

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

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