~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/wince/wininc/cemiss.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 2006 by the Free Pascal development team.
 
4
 
 
5
    Contains missing wince functions present in win32 api
 
6
 
 
7
    See the file COPYING.FPC, included in this distribution,
 
8
    for details about the copyright.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
 
 
14
 **********************************************************************}
 
15
{
 
16
  *What should contain this file*
 
17
  
 
18
  functions missing on wince api
 
19
 
 
20
}
 
21
 
 
22
{$ifdef read_interface}
 
23
 
 
24
function LoadLibraryA(lpLibFileName:LPCSTR):HINST;
 
25
function RegCreateKeyExA(hKey:HKEY; lpSubKey:LPCSTR; Reserved:DWORD; lpClass:LPSTR; dwOptions:DWORD;samDesired:REGSAM; lpSecurityAttributes:LPSECURITY_ATTRIBUTES; var hkResult: HKEY; lpdwDisposition:LPDWORD):LONG;
 
26
function RegDeleteKeyA(hKey:HKEY; lpSubKey:LPCSTR):LONG;
 
27
function RegDeleteValueA(hKey:HKEY; lpValueName:LPCSTR):LONG;
 
28
function RegEnumKeyExA(hKey:HKEY; dwIndex:DWORD; lpName:LPSTR; var cbName:DWORD; lpReserved:LPDWORD;lpClass:LPSTR; lpcbClass:LPDWORD; lpftLastWriteTime:PFILETIME):LONG;
 
29
function RegEnumValueA(hKey:HKEY; dwIndex:DWORD; lpValueName:LPSTR; var cbValueName: DWORD; lpReserved:LPDWORD;lpType:LPDWORD; lpData:pointer; lpcbData:LPDWORD):LONG;
 
30
function RegQueryValueExA(hKey:HKEY; lpValueName:LPCSTR; lpReserved:LPDWORD; lpType:LPDWORD; lpData:pointer;lpcbData:LPDWORD):LONG;
 
31
function RegQueryInfoKeyA(hKey:HKEY; lpClass:LPSTR; lpcbClass:LPDWORD; lpReserved:LPDWORD; lpcSubKeys:LPDWORD;lpcbMaxSubKeyLen:LPDWORD; lpcbMaxClassLen:LPDWORD; lpcValues:LPDWORD; lpcbMaxValueNameLen:LPDWORD;
 
32
  lpcbMaxValueLen:LPDWORD;lpcbSecurityDescriptor:LPDWORD; lpftLastWriteTime:PFILETIME):LONG;
 
33
function RegOpenKeyExA(hKey:HKEY; lpSubKey:LPCSTR; ulOptions:DWORD; samDesired:REGSAM; var hkResult: HKEY):LONG;
 
34
function RegSetValueExA(hKey:HKEY; lpValueName:LPCSTR; Reserved:DWORD; dwType:DWORD; lpData:pointer;cbData:DWORD):LONG;
 
35
 
 
36
{$endif read_interface}
 
37
 
 
38
 
 
39
{$ifdef read_implementation}
 
40
 
 
41
function LoadLibraryA(lpLibFileName:LPCSTR):HINST;
 
42
var  ws: PWideChar;
 
43
begin
 
44
  ws:=PCharToPWideChar(lpLibFileName);
 
45
  Result:=Windows.LoadLibrary(ws);
 
46
  FreeMem(ws);
 
47
end;
 
48
 
 
49
function RegCreateKeyExA(hKey:HKEY; lpSubKey:LPCSTR; Reserved:DWORD; lpClass:LPSTR; dwOptions:DWORD;samDesired:REGSAM; lpSecurityAttributes:LPSECURITY_ATTRIBUTES; var hkResult: HKEY; lpdwDisposition:LPDWORD):LONG;
 
50
var  lpwsSubKey,
 
51
     lpwsClass: PWideChar;
 
52
begin
 
53
 lpwsSubKey:=PCharToPWideChar(lpSubKey);
 
54
 lpwsClass:=PCharToPWideChar(lpClass);
 
55
 Result:=RegCreateKeyExW(hKey,lpwsSubKey,Reserved,lpwsClass,dwOptions,samDesired,lpSecurityAttributes, hkResult,lpdwDisposition);
 
56
 FreeMem(lpwsClass); FreeMem(lpwsSubKey);
 
57
end;
 
58
 
 
59
function RegDeleteKeyA(hKey:HKEY; lpSubKey:LPCSTR):LONG;
 
60
var  lpwsSubKey: PWideChar;
 
61
begin
 
62
 lpwsSubKey:=PCharToPWideChar(lpSubKey);
 
63
 Result:=RegDeleteKeyW(hKey,lpwsSubKey);
 
64
 FreeMem(lpwsSubKey);
 
65
end;
 
66
 
 
67
function RegDeleteValueA(hKey:HKEY; lpValueName:LPCSTR):LONG;
 
68
var  lpwsValueName: PWideChar;
 
69
begin
 
70
 lpwsValueName:=PCharToPWideChar(lpValueName);
 
71
 Result:=RegDeleteValueW(hKey,lpwsValueName);
 
72
 FreeMem(lpwsValueName);
 
73
end;
 
74
 
 
75
function RegEnumKeyExA(hKey:HKEY; dwIndex:DWORD; lpName:LPSTR; var cbName:DWORD; lpReserved:LPDWORD;lpClass:LPSTR; lpcbClass:LPDWORD; lpftLastWriteTime:PFILETIME):LONG;
 
76
var
 
77
  ClassBuf, NameBuf: array[0..255] of WideChar;
 
78
  csz, nsz: DWORD;
 
79
begin
 
80
 csz:=SizeOf(ClassBuf) div SizeOf(WideChar);
 
81
 nsz:=SizeOf(NameBuf) div SizeOf(WideChar);
 
82
 Result:=RegEnumKeyExW(hKey, dwIndex, NameBuf, nsz, lpReserved, ClassBuf, @csz, lpftLastWriteTime);
 
83
 if cbName > nsz then
 
84
   WideToAnsiBuf(NameBuf, nsz, lpName, cbName);
 
85
 cbName:=nsz;
 
86
 if (Result = 0) and (lpcbClass <> nil) then begin
 
87
   if (lpClass <> nil) and (lpcbClass^ > csz) then
 
88
     WideToAnsiBuf(ClassBuf, csz, lpClass, lpcbClass^);
 
89
   lpcbClass^:=csz;
 
90
 end;
 
91
end;
 
92
 
 
93
function RegEnumValueA(hKey:HKEY; dwIndex:DWORD; lpValueName:LPSTR; var cbValueName: DWORD; lpReserved:LPDWORD;lpType:LPDWORD; lpData:pointer; lpcbData:LPDWORD):LONG;
 
94
var
 
95
  t, sz, nsz: DWORD;
 
96
  DataBuf: pointer;
 
97
  NameBuf: array[0..255] of WideChar;
 
98
begin
 
99
 if lpcbData <> nil then
 
100
   sz:=lpcbData^
 
101
 else
 
102
   sz:=0;
 
103
 if lpData <> nil then begin
 
104
   sz:=sz*2;
 
105
   GetMem(DataBuf, sz);
 
106
 end
 
107
 else
 
108
   DataBuf:=nil;
 
109
 nsz:=SizeOf(NameBuf) div SizeOf(WideChar);
 
110
 Result:=RegEnumValueW(hKey, dwIndex, NameBuf, @nsz, lpReserved, @t, DataBuf, @sz);
 
111
 if cbValueName > nsz then
 
112
   WideToAnsiBuf(NameBuf, nsz, lpValueName, cbValueName);
 
113
 cbValueName:=nsz;
 
114
 if Result = 0 then begin
 
115
   if lpType <> nil then
 
116
     lpType^:=t;
 
117
   if lpcbData <> nil then begin
 
118
     if (lpData <> nil) and (t in [REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ]) then
 
119
       sz:=WideCharToMultiByte(CP_ACP, 0, DataBuf, sz div SizeOf(WideChar), lpData, lpcbData^, nil, nil)
 
120
     else begin
 
121
       if sz > lpcbData^ then
 
122
         Result:=ERROR_MORE_DATA
 
123
       else
 
124
         if lpData <> nil then
 
125
           Move(DataBuf^, lpData^, sz);
 
126
     end;
 
127
     lpcbData^:=sz;
 
128
   end;
 
129
 end;
 
130
 if DataBuf <> nil then
 
131
   FreeMem(DataBuf);
 
132
end;
 
133
 
 
134
function RegQueryValueExA(hKey:HKEY; lpValueName:LPCSTR; lpReserved:LPDWORD; lpType:LPDWORD; lpData:pointer;lpcbData:LPDWORD):LONG;
 
135
var
 
136
  lpwsValueName: PWideChar;
 
137
  t, sz: DWORD;
 
138
  DataBuf: pointer;
 
139
begin
 
140
 if lpcbData <> nil then
 
141
   sz:=lpcbData^
 
142
 else
 
143
   sz:=0;
 
144
 if lpData <> nil then begin
 
145
   sz:=sz*2;
 
146
   GetMem(DataBuf, sz);
 
147
 end
 
148
 else
 
149
   DataBuf:=nil;
 
150
 lpwsValueName:=PCharToPWideChar(lpValueName);
 
151
 Result:=RegQueryValueExW(hKey, lpwsValueName, lpReserved, @t, DataBuf, @sz);
 
152
 FreeMem(lpwsValueName);
 
153
 if Result = 0 then begin
 
154
   if lpType <> nil then
 
155
     lpType^:=t;
 
156
   if lpcbData <> nil then begin
 
157
     if t in [REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ] then begin
 
158
       sz:=sz div SizeOf(WideChar);
 
159
       if lpData <> nil then
 
160
         sz:=WideCharToMultiByte(CP_ACP, 0, DataBuf, sz, lpData, lpcbData^, nil, nil);
 
161
     end
 
162
     else begin
 
163
       if sz > lpcbData^ then
 
164
         Result:=ERROR_MORE_DATA
 
165
       else
 
166
         if lpData <> nil then
 
167
           Move(DataBuf^, lpData^, sz);
 
168
     end;
 
169
     lpcbData^:=sz;
 
170
   end;
 
171
 end;
 
172
 if DataBuf <> nil then
 
173
   FreeMem(DataBuf);
 
174
end;
 
175
 
 
176
function RegQueryInfoKeyA(hKey:HKEY; lpClass:LPSTR; lpcbClass:LPDWORD; lpReserved:LPDWORD; lpcSubKeys:LPDWORD;lpcbMaxSubKeyLen:LPDWORD; lpcbMaxClassLen:LPDWORD; lpcValues:LPDWORD; lpcbMaxValueNameLen:LPDWORD;
 
177
  lpcbMaxValueLen:LPDWORD;lpcbSecurityDescriptor:LPDWORD; lpftLastWriteTime:PFILETIME):LONG;
 
178
var
 
179
  ClassBuf: array[0..255] of WideChar;
 
180
  csz: DWORD;
 
181
begin
 
182
 csz:=SizeOf(ClassBuf) div SizeOf(WideChar);
 
183
 Result:=RegQueryInfoKeyW(hKey, ClassBuf, @csz, lpReserved, lpcSubKeys , lpcbMaxSubKeyLen, lpcbMaxClassLen,
 
184
                          lpcValues, lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor, lpftLastWriteTime);
 
185
 if (Result = 0) and (lpcbClass <> nil) then begin
 
186
   if (lpClass <> nil) and (lpcbClass^ > csz) then
 
187
     WideToAnsiBuf(ClassBuf, csz, lpClass, lpcbClass^);
 
188
   lpcbClass^:=csz;
 
189
 end;
 
190
end;
 
191
 
 
192
function RegOpenKeyExA(hKey:HKEY; lpSubKey:LPCSTR; ulOptions:DWORD; samDesired:REGSAM; var hkResult: HKEY):LONG;
 
193
var  lpwsSubKey: PWideChar;
 
194
begin
 
195
 lpwsSubKey:=PCharToPWideChar(lpSubKey);
 
196
 Result:=RegOpenKeyExW(hKey, lpwsSubKey, ulOptions, samDesired, hkResult);
 
197
 FreeMem(lpwsSubKey);
 
198
end;
 
199
 
 
200
function RegSetValueExA(hKey:HKEY; lpValueName:LPCSTR; Reserved:DWORD; dwType:DWORD; lpData:pointer;cbData:DWORD):LONG;
 
201
var
 
202
  lpwsValueName: PWideChar;
 
203
  DataBuf: pointer;
 
204
  sz: DWORD;
 
205
begin
 
206
 lpwsValueName:=PCharToPWideChar(lpValueName);
 
207
 if dwType in [REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ] then begin
 
208
   DataBuf:=PCharToPWideChar(lpData, cbData, @sz);
 
209
   if (cbData > 0) and (PChar(lpData)[cbData - 1] <> #0) then
 
210
     Inc(sz, SizeOf(WideChar));
 
211
   cbData:=sz;
 
212
 end
 
213
 else
 
214
   DataBuf:=lpData;
 
215
 Result:=RegSetValueExW(hKey, lpwsValueName, Reserved, dwType, DataBuf, cbData);
 
216
 FreeMem(lpwsValueName);
 
217
 if DataBuf <> nil then
 
218
   FreeMem(DataBuf);
 
219
end;
 
220
 
 
221
{$endif read_implementation}
 
222