| 1 | /* $Id: ntdll.c,v 1.1 1999-05-24 20:19:31 ktk Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | *
|
|---|
| 5 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 6 | *
|
|---|
| 7 | */
|
|---|
| 8 | /*
|
|---|
| 9 | * Win32 NT Runtime for OS/2
|
|---|
| 10 | *
|
|---|
| 11 | * 1998/05/20 Patrick Haller (haller@zebra.fh-weingarten.de)
|
|---|
| 12 | *
|
|---|
| 13 | * @(#) ntdll.cpp 1.0.1 1999/05/08 SvL: Changes for compilation with Wine headers
|
|---|
| 14 | * 1.0.0 1998/05/20 PH Start from WINE/NTDLL.C
|
|---|
| 15 | *
|
|---|
| 16 | * NT basis DLL
|
|---|
| 17 | *
|
|---|
| 18 | * Copyright 1996 Marcus Meissner
|
|---|
| 19 | * Copyright 1998 Patrick Haller (adapted for win32os2)
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | /* Changes to the original NTDLL.C from the WINE project
|
|---|
| 23 |
|
|---|
| 24 | - includes replaced by the win32os2 standard includes
|
|---|
| 25 | - replaced WINAPI by WIN32API
|
|---|
| 26 | - moved in some string functions
|
|---|
| 27 | - replaced HANDLE32 by HANDLE
|
|---|
| 28 | - lstrlen32A -> OS2lstrlenA
|
|---|
| 29 | - lstrlen32W -> OS2lstrlenW
|
|---|
| 30 | */
|
|---|
| 31 |
|
|---|
| 32 | /*****************************************************************************
|
|---|
| 33 | * Includes *
|
|---|
| 34 | *****************************************************************************/
|
|---|
| 35 |
|
|---|
| 36 | #include <os2win.h>
|
|---|
| 37 | #include <winnt.h>
|
|---|
| 38 | #include <ntdef.h>
|
|---|
| 39 |
|
|---|
| 40 | #include <builtin.h>
|
|---|
| 41 | #include <stdlib.h>
|
|---|
| 42 | #include <string.h>
|
|---|
| 43 | #include <ctype.h>
|
|---|
| 44 | #include "misc.h"
|
|---|
| 45 | #include "unicode.h"
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | /*****************************************************************************
|
|---|
| 49 | * Types & Defines *
|
|---|
| 50 | *****************************************************************************/
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 | /***********************************************************************
|
|---|
| 54 | * lstrcpynAtoW (Not a Windows API)
|
|---|
| 55 | * Note: this function differs from the UNIX strncpy, it _always_ writes
|
|---|
| 56 | * a terminating \0
|
|---|
| 57 | */
|
|---|
| 58 | LPWSTR WIN32API lstrcpynAtoW(LPWSTR dst,
|
|---|
| 59 | LPCSTR src,
|
|---|
| 60 | INT n)
|
|---|
| 61 | {
|
|---|
| 62 | LPWSTR p = dst;
|
|---|
| 63 | while ((n-- > 1) && *src) *p++ = (WCHAR)(unsigned char)*src++;
|
|---|
| 64 | if (n >= 0) *p = 0;
|
|---|
| 65 | return dst;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | /***********************************************************************
|
|---|
| 70 | * lstrcpynWtoA (Not a Windows API)
|
|---|
| 71 | * Note: this function differs from the UNIX strncpy, it _always_ writes
|
|---|
| 72 | * a terminating \0
|
|---|
| 73 | */
|
|---|
| 74 | LPSTR WIN32API lstrcpynWtoA(LPSTR dst,
|
|---|
| 75 | LPCWSTR src,
|
|---|
| 76 | INT n)
|
|---|
| 77 | {
|
|---|
| 78 | LPSTR p = dst;
|
|---|
| 79 | while ((n-- > 1) && *src) *p++ = (CHAR)*src++;
|
|---|
| 80 | if (n >= 0) *p = 0;
|
|---|
| 81 | return dst;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | /***********************************************************************
|
|---|
| 86 | * HEAP_strdupA
|
|---|
| 87 | */
|
|---|
| 88 | LPSTR HEAP_strdupA(HANDLE heap,
|
|---|
| 89 | DWORD flags,
|
|---|
| 90 | LPCSTR str)
|
|---|
| 91 | {
|
|---|
| 92 | LPSTR p = HeapAlloc(heap,
|
|---|
| 93 | flags,
|
|---|
| 94 | lstrlenA(str) + 1 );
|
|---|
| 95 |
|
|---|
| 96 | lstrcpyA(p, str);
|
|---|
| 97 | return p;
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 | /***********************************************************************
|
|---|
| 102 | * HEAP_strdupW
|
|---|
| 103 | */
|
|---|
| 104 | LPWSTR HEAP_strdupW(HANDLE heap,
|
|---|
| 105 | DWORD flags,
|
|---|
| 106 | LPCWSTR str)
|
|---|
| 107 | {
|
|---|
| 108 | INT len = lstrlenW(str) + 1;
|
|---|
| 109 | LPWSTR p = HeapAlloc(heap,
|
|---|
| 110 | flags,
|
|---|
| 111 | len * sizeof(WCHAR) );
|
|---|
| 112 | lstrcpyW(p,
|
|---|
| 113 | str);
|
|---|
| 114 | return p;
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 | /***********************************************************************
|
|---|
| 119 | * HEAP_strdupWtoA
|
|---|
| 120 | */
|
|---|
| 121 | LPSTR HEAP_strdupWtoA(HANDLE heap,
|
|---|
| 122 | DWORD flags,
|
|---|
| 123 | LPCWSTR str )
|
|---|
| 124 | {
|
|---|
| 125 | LPSTR ret;
|
|---|
| 126 |
|
|---|
| 127 | if (!str)
|
|---|
| 128 | return NULL;
|
|---|
| 129 |
|
|---|
| 130 | ret = HeapAlloc(heap,
|
|---|
| 131 | flags,
|
|---|
| 132 | lstrlenW(str) + 1 );
|
|---|
| 133 | UnicodeToAscii((LPWSTR)str,
|
|---|
| 134 | ret);
|
|---|
| 135 | /* lstrcpyWtoA(ret,
|
|---|
| 136 | str);*/
|
|---|
| 137 | return ret;
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | /***********************************************************************
|
|---|
| 141 | * HEAP_strdupAtoW
|
|---|
| 142 | */
|
|---|
| 143 | LPWSTR HEAP_strdupAtoW(HANDLE heap,
|
|---|
| 144 | DWORD flags,
|
|---|
| 145 | LPCSTR str)
|
|---|
| 146 | {
|
|---|
| 147 | LPWSTR ret;
|
|---|
| 148 |
|
|---|
| 149 | if (!str)
|
|---|
| 150 | return NULL;
|
|---|
| 151 |
|
|---|
| 152 | ret = HeapAlloc(heap,
|
|---|
| 153 | flags,
|
|---|
| 154 | (lstrlenA(str)+1) * sizeof(WCHAR) );
|
|---|
| 155 | AsciiToUnicode((char *)str,
|
|---|
| 156 | ret);
|
|---|
| 157 | /* lstrcpyAtoW(ret,
|
|---|
| 158 | str );*/
|
|---|
| 159 |
|
|---|
| 160 | return ret;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 | /**************************************************************************
|
|---|
| 165 | * RtlLengthRequiredSid [NTDLL]
|
|---|
| 166 | */
|
|---|
| 167 | DWORD WIN32API RtlLengthRequiredSid(DWORD nrofsubauths)
|
|---|
| 168 | {
|
|---|
| 169 | dprintf(("NTDLL: RtlLengthRequireSid(%08x)\n",
|
|---|
| 170 | nrofsubauths));
|
|---|
| 171 |
|
|---|
| 172 | return sizeof(DWORD)*nrofsubauths+sizeof(SID);
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | /**************************************************************************
|
|---|
| 176 | * RtlLengthSid [NTDLL]
|
|---|
| 177 | */
|
|---|
| 178 | DWORD WIN32API RtlLengthSid(PSID sid)
|
|---|
| 179 | {
|
|---|
| 180 | dprintf(("NTDLL: RtlLengthSid(%08x)\n",
|
|---|
| 181 | sid));
|
|---|
| 182 |
|
|---|
| 183 | return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID);
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | /**************************************************************************
|
|---|
| 187 | * RtlCreateAcl [NTDLL]
|
|---|
| 188 | *
|
|---|
| 189 | * NOTES
|
|---|
| 190 | * This should return NTSTATUS
|
|---|
| 191 | */
|
|---|
| 192 | DWORD WIN32API RtlCreateAcl(PACL acl,
|
|---|
| 193 | DWORD size,
|
|---|
| 194 | DWORD rev)
|
|---|
| 195 | {
|
|---|
| 196 | dprintf(("NTDLL: RtlCreateAcl(%08x,%08x,%08x)\n",
|
|---|
| 197 | acl,
|
|---|
| 198 | size,
|
|---|
| 199 | rev));
|
|---|
| 200 |
|
|---|
| 201 | if (rev!=ACL_REVISION)
|
|---|
| 202 | return STATUS_INVALID_PARAMETER;
|
|---|
| 203 |
|
|---|
| 204 | if (size<sizeof(ACL))
|
|---|
| 205 | return STATUS_BUFFER_TOO_SMALL;
|
|---|
| 206 |
|
|---|
| 207 | if (size>0xFFFF)
|
|---|
| 208 | return STATUS_INVALID_PARAMETER;
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | memset(acl,
|
|---|
| 212 | '\0',
|
|---|
| 213 | sizeof(ACL));
|
|---|
| 214 |
|
|---|
| 215 | acl->AclRevision = rev;
|
|---|
| 216 | acl->AclSize = size;
|
|---|
| 217 | acl->AceCount = 0;
|
|---|
| 218 | return 0;
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | /**************************************************************************
|
|---|
| 222 | * RtlFirstFreeAce [NTDLL]
|
|---|
| 223 | * looks for the AceCount+1 ACE, and if it is still within the alloced
|
|---|
| 224 | * ACL, return a pointer to it
|
|---|
| 225 | */
|
|---|
| 226 | BOOL WIN32API RtlFirstFreeAce(PACL acl,
|
|---|
| 227 | PACE_HEADER *x)
|
|---|
| 228 | {
|
|---|
| 229 | PACE_HEADER ace;
|
|---|
| 230 | int i;
|
|---|
| 231 |
|
|---|
| 232 | dprintf(("NTDLL: RtlFirstFreeAce(%08x,%08x)\n",
|
|---|
| 233 | acl,
|
|---|
| 234 | x));
|
|---|
| 235 |
|
|---|
| 236 | *x = 0;
|
|---|
| 237 | ace = (PACE_HEADER)(acl+1);
|
|---|
| 238 | for (i=0;i<acl->AceCount;i++) {
|
|---|
| 239 | if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
|
|---|
| 240 | return 0;
|
|---|
| 241 | ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|---|
| 242 | }
|
|---|
| 243 | if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
|
|---|
| 244 | return 0;
|
|---|
| 245 | *x = ace;
|
|---|
| 246 | return 1;
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | /**************************************************************************
|
|---|
| 250 | * RtlAddAce [NTDLL]
|
|---|
| 251 | */
|
|---|
| 252 | DWORD WIN32API RtlAddAce(PACL acl,
|
|---|
| 253 | DWORD rev,
|
|---|
| 254 | DWORD xnrofaces,
|
|---|
| 255 | PACE_HEADER acestart,
|
|---|
| 256 | DWORD acelen)
|
|---|
| 257 | {
|
|---|
| 258 | PACE_HEADER ace,targetace;
|
|---|
| 259 | int nrofaces;
|
|---|
| 260 |
|
|---|
| 261 | dprintf(("NTDLL: RtlAddAce(%08x,%08x,%08x,%08x,%08x)\n",
|
|---|
| 262 | acl,
|
|---|
| 263 | rev,
|
|---|
| 264 | xnrofaces,
|
|---|
| 265 | acestart,
|
|---|
| 266 | acelen));
|
|---|
| 267 |
|
|---|
| 268 | if (acl->AclRevision != ACL_REVISION)
|
|---|
| 269 | return STATUS_INVALID_PARAMETER;
|
|---|
| 270 | if (!RtlFirstFreeAce(acl,&targetace))
|
|---|
| 271 | return STATUS_INVALID_PARAMETER;
|
|---|
| 272 | nrofaces=0;ace=acestart;
|
|---|
| 273 | while (((DWORD)ace-(DWORD)acestart)<acelen) {
|
|---|
| 274 | nrofaces++;
|
|---|
| 275 | ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|---|
| 276 | }
|
|---|
| 277 | if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
|
|---|
| 278 | return STATUS_INVALID_PARAMETER;
|
|---|
| 279 | memcpy((LPBYTE)targetace,acestart,acelen);
|
|---|
| 280 | acl->AceCount+=nrofaces;
|
|---|
| 281 | return 0;
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | /**************************************************************************
|
|---|
| 285 | * RtlCreateSecurityDescriptor [NTDLL]
|
|---|
| 286 | */
|
|---|
| 287 | DWORD WIN32API RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR lpsd,
|
|---|
| 288 | DWORD rev)
|
|---|
| 289 | {
|
|---|
| 290 | dprintf(("NTDLL: RtlCreateSecurityDescriptor(%08x,%08x)\n",
|
|---|
| 291 | lpsd,
|
|---|
| 292 | rev));
|
|---|
| 293 |
|
|---|
| 294 | if (rev!=SECURITY_DESCRIPTOR_REVISION)
|
|---|
| 295 | return STATUS_UNKNOWN_REVISION;
|
|---|
| 296 |
|
|---|
| 297 | memset(lpsd,
|
|---|
| 298 | '\0',
|
|---|
| 299 | sizeof(*lpsd));
|
|---|
| 300 | lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
|
|---|
| 301 | return 0;
|
|---|
| 302 | }
|
|---|
| 303 |
|
|---|
| 304 | /**************************************************************************
|
|---|
| 305 | * RtlSetDaclSecurityDescriptor [NTDLL]
|
|---|
| 306 | */
|
|---|
| 307 | DWORD WIN32API RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
|
|---|
| 308 | BOOL daclpresent,
|
|---|
| 309 | PACL dacl,
|
|---|
| 310 | BOOL dacldefaulted )
|
|---|
| 311 | {
|
|---|
| 312 | dprintf(("NTDLL: RtlSetDaclSecurityDescriptor(%08x,%08x,%08x,%08x)\n",
|
|---|
| 313 | lpsd,
|
|---|
| 314 | daclpresent,
|
|---|
| 315 | dacl,
|
|---|
| 316 | dacldefaulted));
|
|---|
| 317 |
|
|---|
| 318 | if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|---|
| 319 | return STATUS_UNKNOWN_REVISION;
|
|---|
| 320 |
|
|---|
| 321 | if (lpsd->Control & SE_SELF_RELATIVE)
|
|---|
| 322 | return STATUS_INVALID_SECURITY_DESCR;
|
|---|
| 323 |
|
|---|
| 324 | if (!daclpresent)
|
|---|
| 325 | {
|
|---|
| 326 | lpsd->Control &= ~SE_DACL_PRESENT;
|
|---|
| 327 | return 0;
|
|---|
| 328 | }
|
|---|
| 329 |
|
|---|
| 330 | lpsd->Control |= SE_DACL_PRESENT;
|
|---|
| 331 | lpsd->Dacl = dacl;
|
|---|
| 332 |
|
|---|
| 333 | if (dacldefaulted)
|
|---|
| 334 | lpsd->Control |= SE_DACL_DEFAULTED;
|
|---|
| 335 | else
|
|---|
| 336 | lpsd->Control &= ~SE_DACL_DEFAULTED;
|
|---|
| 337 |
|
|---|
| 338 | return 0;
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | /**************************************************************************
|
|---|
| 342 | * RtlSetSaclSecurityDescriptor [NTDLL]
|
|---|
| 343 | */
|
|---|
| 344 | DWORD WIN32API RtlSetSaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
|
|---|
| 345 | BOOL saclpresent,
|
|---|
| 346 | PACL sacl,
|
|---|
| 347 | BOOL sacldefaulted)
|
|---|
| 348 | {
|
|---|
| 349 | dprintf(("NTDLL: RtlSetSaclSecurityDescriptor(%08x,%08x,%08x,%08x)\n",
|
|---|
| 350 | lpsd,
|
|---|
| 351 | saclpresent,
|
|---|
| 352 | sacl,
|
|---|
| 353 | sacldefaulted));
|
|---|
| 354 |
|
|---|
| 355 | if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|---|
| 356 | return STATUS_UNKNOWN_REVISION;
|
|---|
| 357 |
|
|---|
| 358 | if (lpsd->Control & SE_SELF_RELATIVE)
|
|---|
| 359 | return STATUS_INVALID_SECURITY_DESCR;
|
|---|
| 360 |
|
|---|
| 361 | if (!saclpresent)
|
|---|
| 362 | {
|
|---|
| 363 | lpsd->Control &= ~SE_SACL_PRESENT;
|
|---|
| 364 | return 0;
|
|---|
| 365 | }
|
|---|
| 366 |
|
|---|
| 367 | lpsd->Control |= SE_SACL_PRESENT;
|
|---|
| 368 | lpsd->Sacl = sacl;
|
|---|
| 369 |
|
|---|
| 370 | if (sacldefaulted)
|
|---|
| 371 | lpsd->Control |= SE_SACL_DEFAULTED;
|
|---|
| 372 | else
|
|---|
| 373 | lpsd->Control &= ~SE_SACL_DEFAULTED;
|
|---|
| 374 |
|
|---|
| 375 | return 0;
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | /**************************************************************************
|
|---|
| 379 | * RtlSetOwnerSecurityDescriptor [NTDLL]
|
|---|
| 380 | */
|
|---|
| 381 | DWORD WIN32API RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
|
|---|
| 382 | PSID owner,
|
|---|
| 383 | BOOL ownerdefaulted)
|
|---|
| 384 | {
|
|---|
| 385 | dprintf(("NTDLL: RtlSetOwnerSecurityDescriptor(%08x,%08x,%08x)\n",
|
|---|
| 386 | lpsd,
|
|---|
| 387 | owner,
|
|---|
| 388 | ownerdefaulted));
|
|---|
| 389 |
|
|---|
| 390 | if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|---|
| 391 | return STATUS_UNKNOWN_REVISION;
|
|---|
| 392 |
|
|---|
| 393 | if (lpsd->Control & SE_SELF_RELATIVE)
|
|---|
| 394 | return STATUS_INVALID_SECURITY_DESCR;
|
|---|
| 395 |
|
|---|
| 396 | lpsd->Owner = owner;
|
|---|
| 397 |
|
|---|
| 398 | if (ownerdefaulted)
|
|---|
| 399 | lpsd->Control |= SE_OWNER_DEFAULTED;
|
|---|
| 400 | else
|
|---|
| 401 | lpsd->Control &= ~SE_OWNER_DEFAULTED;
|
|---|
| 402 |
|
|---|
| 403 | return 0;
|
|---|
| 404 | }
|
|---|
| 405 |
|
|---|
| 406 | /**************************************************************************
|
|---|
| 407 | * RtlSetOwnerSecurityDescriptor [NTDLL]
|
|---|
| 408 | */
|
|---|
| 409 | DWORD WIN32API RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
|
|---|
| 410 | PSID group,
|
|---|
| 411 | BOOL groupdefaulted)
|
|---|
| 412 | {
|
|---|
| 413 | dprintf(("NTDLL: SetGroupSecurityDescriptor(%08x,%08x,%08x)\n",
|
|---|
| 414 | lpsd,
|
|---|
| 415 | group,
|
|---|
| 416 | groupdefaulted));
|
|---|
| 417 |
|
|---|
| 418 | if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|---|
| 419 | return STATUS_UNKNOWN_REVISION;
|
|---|
| 420 |
|
|---|
| 421 | if (lpsd->Control & SE_SELF_RELATIVE)
|
|---|
| 422 | return STATUS_INVALID_SECURITY_DESCR;
|
|---|
| 423 |
|
|---|
| 424 | lpsd->Group = group;
|
|---|
| 425 |
|
|---|
| 426 | if (groupdefaulted)
|
|---|
| 427 | lpsd->Control |= SE_GROUP_DEFAULTED;
|
|---|
| 428 | else
|
|---|
| 429 | lpsd->Control &= ~SE_GROUP_DEFAULTED;
|
|---|
| 430 |
|
|---|
| 431 | return 0;
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 | /**************************************************************************
|
|---|
| 436 | * RtlNormalizeProcessParams [NTDLL]
|
|---|
| 437 | */
|
|---|
| 438 | LPVOID WIN32API RtlNormalizeProcessParams(LPVOID x)
|
|---|
| 439 | {
|
|---|
| 440 | dprintf(("NTDLL: RtlNormalizeProcessParams(%08xh)\n",
|
|---|
| 441 | x));
|
|---|
| 442 |
|
|---|
| 443 | return x;
|
|---|
| 444 | }
|
|---|
| 445 |
|
|---|
| 446 | /**************************************************************************
|
|---|
| 447 | * RtlInitializeSid [NTDLL]
|
|---|
| 448 | */
|
|---|
| 449 | DWORD WIN32API RtlInitializeSid(PSID PSID,
|
|---|
| 450 | PSID_IDENTIFIER_AUTHORITY PSIDauth,
|
|---|
| 451 | DWORD c)
|
|---|
| 452 | {
|
|---|
| 453 | BYTE a = c&0xff;
|
|---|
| 454 |
|
|---|
| 455 | dprintf(("NTDLL: RtlInitializeSid(%08x,%08x,%08x)\n",
|
|---|
| 456 | PSID,
|
|---|
| 457 | PSIDauth,
|
|---|
| 458 | c));
|
|---|
| 459 |
|
|---|
| 460 | if (a>=SID_MAX_SUB_AUTHORITIES)
|
|---|
| 461 | return a;
|
|---|
| 462 |
|
|---|
| 463 | PSID->SubAuthorityCount = a;
|
|---|
| 464 | PSID->Revision = SID_REVISION;
|
|---|
| 465 |
|
|---|
| 466 | memcpy(&(PSID->IdentifierAuthority),
|
|---|
| 467 | PSIDauth,
|
|---|
| 468 | sizeof(SID_IDENTIFIER_AUTHORITY));
|
|---|
| 469 |
|
|---|
| 470 | return 0;
|
|---|
| 471 | }
|
|---|
| 472 |
|
|---|
| 473 | /**************************************************************************
|
|---|
| 474 | * RtlSubAuthoritySid [NTDLL]
|
|---|
| 475 | */
|
|---|
| 476 | LPDWORD WIN32API RtlSubAuthoritySid(PSID PSID,
|
|---|
| 477 | DWORD nr)
|
|---|
| 478 | {
|
|---|
| 479 | dprintf(("NTDLL: RtlSubAuthoritySid(%08x,%08d)\n",
|
|---|
| 480 | PSID,
|
|---|
| 481 | nr));
|
|---|
| 482 |
|
|---|
| 483 | return &(PSID->SubAuthority[nr]);
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 | /**************************************************************************
|
|---|
| 487 | * RtlSubAuthorityCountSid [NTDLL]
|
|---|
| 488 | */
|
|---|
| 489 | LPBYTE WIN32API RtlSubAuthorityCountSid(PSID PSID)
|
|---|
| 490 | {
|
|---|
| 491 | dprintf(("NTDLL: RtlSubAuthorityCountSid(%08x)\n",
|
|---|
| 492 | PSID));
|
|---|
| 493 |
|
|---|
| 494 | return ((LPBYTE)PSID)+1;
|
|---|
| 495 | }
|
|---|
| 496 |
|
|---|
| 497 | /**************************************************************************
|
|---|
| 498 | * RtlCopySid [NTDLL]
|
|---|
| 499 | */
|
|---|
| 500 | DWORD WIN32API RtlCopySid(DWORD len,
|
|---|
| 501 | PSID to,
|
|---|
| 502 | PSID from)
|
|---|
| 503 | {
|
|---|
| 504 | dprintf(("NTDLL: RtlCopySid(%08x,%08x,%08x)\n",
|
|---|
| 505 | len,
|
|---|
| 506 | to,
|
|---|
| 507 | from));
|
|---|
| 508 |
|
|---|
| 509 | if (len<(from->SubAuthorityCount*4+8))
|
|---|
| 510 | return STATUS_BUFFER_TOO_SMALL;
|
|---|
| 511 |
|
|---|
| 512 | memmove(to,
|
|---|
| 513 | from,
|
|---|
| 514 | from->SubAuthorityCount*4+8);
|
|---|
| 515 |
|
|---|
| 516 | return STATUS_SUCCESS;
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 | /**************************************************************************
|
|---|
| 520 | * RtlAnsiStringToUnicodeString [NTDLL]
|
|---|
| 521 | */
|
|---|
| 522 | DWORD WIN32API RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,
|
|---|
| 523 | PANSI_STRING ansi,
|
|---|
| 524 | BOOL doalloc)
|
|---|
| 525 | {
|
|---|
| 526 | DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
|
|---|
| 527 |
|
|---|
| 528 | dprintf(("NTDLL: RtlAnsiStringToUnicodeString(%08x,%s,%08x)\n",
|
|---|
| 529 | uni,
|
|---|
| 530 | ansi,
|
|---|
| 531 | doalloc));
|
|---|
| 532 |
|
|---|
| 533 | if (unilen>0xFFFF)
|
|---|
| 534 | return STATUS_INVALID_PARAMETER_2;
|
|---|
| 535 |
|
|---|
| 536 | uni->Length = unilen;
|
|---|
| 537 |
|
|---|
| 538 | if (doalloc)
|
|---|
| 539 | {
|
|---|
| 540 | uni->MaximumLength = unilen;
|
|---|
| 541 | uni->Buffer = HeapAlloc(GetProcessHeap(),
|
|---|
| 542 | HEAP_ZERO_MEMORY,
|
|---|
| 543 | unilen);
|
|---|
| 544 | if (!uni->Buffer)
|
|---|
| 545 | return STATUS_NO_MEMORY;
|
|---|
| 546 | }
|
|---|
| 547 |
|
|---|
| 548 | if (unilen>uni->MaximumLength)
|
|---|
| 549 | return STATUS_BUFFER_OVERFLOW;
|
|---|
| 550 |
|
|---|
| 551 | lstrcpynAtoW(uni->Buffer,
|
|---|
| 552 | ansi->Buffer,
|
|---|
| 553 | unilen/2);
|
|---|
| 554 |
|
|---|
| 555 | return STATUS_SUCCESS;
|
|---|
| 556 | }
|
|---|
| 557 |
|
|---|
| 558 | /**************************************************************************
|
|---|
| 559 | * RtlOemStringToUnicodeString [NTDLL]
|
|---|
| 560 | */
|
|---|
| 561 | DWORD WIN32API RtlOemStringToUnicodeString(PUNICODE_STRING uni,
|
|---|
| 562 | PSTRING ansi,
|
|---|
| 563 | BOOL doalloc)
|
|---|
| 564 | {
|
|---|
| 565 | DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
|
|---|
| 566 |
|
|---|
| 567 | dprintf(("NTDLL: RtlOemStringToUnicodeString (%08x,%s,%08x)\n",
|
|---|
| 568 | uni,
|
|---|
| 569 | ansi,
|
|---|
| 570 | doalloc));
|
|---|
| 571 |
|
|---|
| 572 | if (unilen>0xFFFF)
|
|---|
| 573 | return STATUS_INVALID_PARAMETER_2;
|
|---|
| 574 |
|
|---|
| 575 | uni->Length = unilen;
|
|---|
| 576 |
|
|---|
| 577 | if (doalloc)
|
|---|
| 578 | {
|
|---|
| 579 | uni->MaximumLength = unilen;
|
|---|
| 580 | uni->Buffer = HeapAlloc(GetProcessHeap(),
|
|---|
| 581 | HEAP_ZERO_MEMORY,
|
|---|
| 582 | unilen);
|
|---|
| 583 |
|
|---|
| 584 | if (!uni->Buffer)
|
|---|
| 585 | return STATUS_NO_MEMORY;
|
|---|
| 586 | }
|
|---|
| 587 |
|
|---|
| 588 | if (unilen>uni->MaximumLength)
|
|---|
| 589 | return STATUS_BUFFER_OVERFLOW;
|
|---|
| 590 |
|
|---|
| 591 | lstrcpynAtoW(uni->Buffer,
|
|---|
| 592 | ansi->Buffer,
|
|---|
| 593 | unilen/2);
|
|---|
| 594 |
|
|---|
| 595 | return STATUS_SUCCESS;
|
|---|
| 596 | }
|
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 | /**************************************************************************
|
|---|
| 600 | * RtlMultiByteToUnicodeN [NTDLL]
|
|---|
| 601 | * FIXME: multibyte support
|
|---|
| 602 | */
|
|---|
| 603 | DWORD WIN32API RtlMultiByteToUnicodeN(LPWSTR unistr,
|
|---|
| 604 | DWORD unilen,
|
|---|
| 605 | LPDWORD reslen,
|
|---|
| 606 | LPSTR oemstr,
|
|---|
| 607 | DWORD oemlen)
|
|---|
| 608 | {
|
|---|
| 609 | DWORD len;
|
|---|
| 610 | LPWSTR x;
|
|---|
| 611 |
|
|---|
| 612 | dprintf(("NTDLL: RtlMultiByteToUnicodeN(%08x,%08x,%08x,%s,%08x)\n",
|
|---|
| 613 | unistr,
|
|---|
| 614 | unilen,
|
|---|
| 615 | reslen,
|
|---|
| 616 | oemstr,
|
|---|
| 617 | oemlen));
|
|---|
| 618 |
|
|---|
| 619 | len = oemlen;
|
|---|
| 620 | if (unilen/2 < len)
|
|---|
| 621 | len = unilen/2;
|
|---|
| 622 |
|
|---|
| 623 | x=(LPWSTR)HeapAlloc(GetProcessHeap(),
|
|---|
| 624 | HEAP_ZERO_MEMORY,
|
|---|
| 625 | (len+1)*sizeof(WCHAR));
|
|---|
| 626 | lstrcpynAtoW(x,
|
|---|
| 627 | oemstr,
|
|---|
| 628 | len+1);
|
|---|
| 629 | memcpy(unistr,
|
|---|
| 630 | x,
|
|---|
| 631 | len*2);
|
|---|
| 632 |
|
|---|
| 633 | if (reslen)
|
|---|
| 634 | *reslen = len*2;
|
|---|
| 635 |
|
|---|
| 636 | return 0;
|
|---|
| 637 | }
|
|---|
| 638 |
|
|---|
| 639 | /**************************************************************************
|
|---|
| 640 | * RtlOemToUnicodeN [NTDLL]
|
|---|
| 641 | */
|
|---|
| 642 | DWORD WIN32API RtlOemToUnicodeN(LPWSTR unistr,
|
|---|
| 643 | DWORD unilen,
|
|---|
| 644 | LPDWORD reslen,
|
|---|
| 645 | LPSTR oemstr,
|
|---|
| 646 | DWORD oemlen)
|
|---|
| 647 | {
|
|---|
| 648 | DWORD len;
|
|---|
| 649 | LPWSTR x;
|
|---|
| 650 |
|
|---|
| 651 | dprintf(("NTDLL: RtlOemToUnicodeN(%08x,%08x,%08x,%s,%08x)\n",
|
|---|
| 652 | unistr,
|
|---|
| 653 | unilen,
|
|---|
| 654 | reslen,
|
|---|
| 655 | oemstr,
|
|---|
| 656 | oemlen));
|
|---|
| 657 |
|
|---|
| 658 | len = oemlen;
|
|---|
| 659 | if (unilen/2 < len)
|
|---|
| 660 | len = unilen/2;
|
|---|
| 661 |
|
|---|
| 662 | x=(LPWSTR)HeapAlloc(GetProcessHeap(),
|
|---|
| 663 | HEAP_ZERO_MEMORY,
|
|---|
| 664 | (len+1)*sizeof(WCHAR));
|
|---|
| 665 |
|
|---|
| 666 | lstrcpynAtoW(x,
|
|---|
| 667 | oemstr,
|
|---|
| 668 | len+1);
|
|---|
| 669 |
|
|---|
| 670 | memcpy(unistr,
|
|---|
| 671 | x,
|
|---|
| 672 | len*2);
|
|---|
| 673 |
|
|---|
| 674 | if (reslen)
|
|---|
| 675 | *reslen = len*2;
|
|---|
| 676 |
|
|---|
| 677 | return 0;
|
|---|
| 678 | }
|
|---|
| 679 |
|
|---|
| 680 | /**************************************************************************
|
|---|
| 681 | * RtlInitString [NTDLL]
|
|---|
| 682 | */
|
|---|
| 683 | VOID WIN32API RtlInitAnsiString(PANSI_STRING target,
|
|---|
| 684 | LPCSTR source)
|
|---|
| 685 | {
|
|---|
| 686 | dprintf(("NTDLL: RtlInitAnsiString(%08x,%08x)\n",
|
|---|
| 687 | target,
|
|---|
| 688 | source));
|
|---|
| 689 |
|
|---|
| 690 | target->Length = target->MaximumLength = 0;
|
|---|
| 691 | target->Buffer = (LPSTR)source;
|
|---|
| 692 | if (!source)
|
|---|
| 693 | return;
|
|---|
| 694 |
|
|---|
| 695 | target->Length = lstrlenA(target->Buffer);
|
|---|
| 696 | target->MaximumLength = target->Length+1;
|
|---|
| 697 | }
|
|---|
| 698 |
|
|---|
| 699 | /**************************************************************************
|
|---|
| 700 | * RtlInitString [NTDLL]
|
|---|
| 701 | */
|
|---|
| 702 | VOID WIN32API RtlInitString(PSTRING target,
|
|---|
| 703 | LPCSTR source)
|
|---|
| 704 | {
|
|---|
| 705 | dprintf(("NTDLL: RtlInitString(%08x,%08x)\n",
|
|---|
| 706 | target,
|
|---|
| 707 | source));
|
|---|
| 708 |
|
|---|
| 709 | target->Length = target->MaximumLength = 0;
|
|---|
| 710 | target->Buffer = (LPSTR)source;
|
|---|
| 711 | if (!source)
|
|---|
| 712 | return;
|
|---|
| 713 |
|
|---|
| 714 | target->Length = lstrlenA(target->Buffer);
|
|---|
| 715 | target->MaximumLength = target->Length+1;
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | /**************************************************************************
|
|---|
| 719 | * RtlInitUnicodeString [NTDLL]
|
|---|
| 720 | */
|
|---|
| 721 | VOID WIN32API RtlInitUnicodeString(PUNICODE_STRING target,
|
|---|
| 722 | LPCWSTR source)
|
|---|
| 723 | {
|
|---|
| 724 | dprintf(("NTDLL: RtlInitUnicodeString(%08x,%08x)\n",
|
|---|
| 725 | target,
|
|---|
| 726 | source));
|
|---|
| 727 |
|
|---|
| 728 | target->Length = target->MaximumLength = 0;
|
|---|
| 729 | target->Buffer = (LPWSTR)source;
|
|---|
| 730 | if (!source)
|
|---|
| 731 | return;
|
|---|
| 732 |
|
|---|
| 733 | target->Length = lstrlenW(target->Buffer)*2;
|
|---|
| 734 | target->MaximumLength = target->Length+2;
|
|---|
| 735 | }
|
|---|
| 736 |
|
|---|
| 737 | /**************************************************************************
|
|---|
| 738 | * RtlFreeUnicodeString [NTDLL]
|
|---|
| 739 | */
|
|---|
| 740 | VOID WIN32API RtlFreeUnicodeString(PUNICODE_STRING str)
|
|---|
| 741 | {
|
|---|
| 742 | dprintf(("NTDLL: RtlFreeUnicodeString(%08x)\n",
|
|---|
| 743 | str));
|
|---|
| 744 |
|
|---|
| 745 | if (str->Buffer)
|
|---|
| 746 | HeapFree(GetProcessHeap(),
|
|---|
| 747 | 0,
|
|---|
| 748 | str->Buffer);
|
|---|
| 749 | }
|
|---|
| 750 |
|
|---|
| 751 | /**************************************************************************
|
|---|
| 752 | * RtlUnicodeToOemN [NTDLL]
|
|---|
| 753 | */
|
|---|
| 754 | DWORD WIN32API RtlUnicodeToOemN(LPSTR oemstr,
|
|---|
| 755 | DWORD oemlen,
|
|---|
| 756 | LPDWORD reslen,
|
|---|
| 757 | LPWSTR unistr,
|
|---|
| 758 | DWORD unilen)
|
|---|
| 759 | {
|
|---|
| 760 | DWORD len;
|
|---|
| 761 | LPSTR x;
|
|---|
| 762 |
|
|---|
| 763 | dprintf(("NTDLL: RtlUnicodeToOemN (%08x,%08x,%08x,%08x,%08x)\n",
|
|---|
| 764 | oemstr,
|
|---|
| 765 | oemlen,
|
|---|
| 766 | reslen,
|
|---|
| 767 | unistr,
|
|---|
| 768 | unilen));
|
|---|
| 769 |
|
|---|
| 770 | len = oemlen;
|
|---|
| 771 | if (unilen/2 < len)
|
|---|
| 772 | len = unilen/2;
|
|---|
| 773 |
|
|---|
| 774 | x=(LPSTR)HeapAlloc(GetProcessHeap(),
|
|---|
| 775 | HEAP_ZERO_MEMORY,
|
|---|
| 776 | len+1);
|
|---|
| 777 |
|
|---|
| 778 | lstrcpynWtoA(x,
|
|---|
| 779 | unistr,
|
|---|
| 780 | len+1);
|
|---|
| 781 |
|
|---|
| 782 | memcpy(oemstr,
|
|---|
| 783 | x,
|
|---|
| 784 | len);
|
|---|
| 785 |
|
|---|
| 786 | if (reslen)
|
|---|
| 787 | *reslen = len;
|
|---|
| 788 |
|
|---|
| 789 | return 0;
|
|---|
| 790 | }
|
|---|
| 791 |
|
|---|
| 792 | /**************************************************************************
|
|---|
| 793 | * RtlUnicodeStringToOemString [NTDLL]
|
|---|
| 794 | */
|
|---|
| 795 | DWORD WIN32API RtlUnicodeStringToOemString(PANSI_STRING oem,
|
|---|
| 796 | PUNICODE_STRING uni,
|
|---|
| 797 | BOOL alloc)
|
|---|
| 798 | {
|
|---|
| 799 | dprintf(("NTDLL: RtlUnicodeStringToOemString (%08x,%08x,%08x)\n",
|
|---|
| 800 | oem,
|
|---|
| 801 | uni,
|
|---|
| 802 | alloc));
|
|---|
| 803 |
|
|---|
| 804 | if (alloc)
|
|---|
| 805 | {
|
|---|
| 806 | oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),
|
|---|
| 807 | HEAP_ZERO_MEMORY,
|
|---|
| 808 | uni->Length/2)+1;
|
|---|
| 809 | oem->MaximumLength = uni->Length/2+1;
|
|---|
| 810 | }
|
|---|
| 811 |
|
|---|
| 812 | oem->Length = uni->Length/2;
|
|---|
| 813 | lstrcpynWtoA(oem->Buffer,
|
|---|
| 814 | uni->Buffer,
|
|---|
| 815 | uni->Length/2+1);
|
|---|
| 816 |
|
|---|
| 817 | return 0;
|
|---|
| 818 | }
|
|---|
| 819 |
|
|---|
| 820 | /**************************************************************************
|
|---|
| 821 | * RtlUnicodeStringToAnsiString [NTDLL]
|
|---|
| 822 | */
|
|---|
| 823 | DWORD WIN32API RtlUnicodeStringToAnsiString(PUNICODE_STRING uni,
|
|---|
| 824 | PANSI_STRING oem,
|
|---|
| 825 | BOOL alloc)
|
|---|
| 826 | {
|
|---|
| 827 | dprintf(("NTDLL: RtlUnicodeStringToAnsiString(%08x,%08x,%08x)\n",
|
|---|
| 828 | uni,
|
|---|
| 829 | oem,
|
|---|
| 830 | alloc));
|
|---|
| 831 |
|
|---|
| 832 | if (alloc)
|
|---|
| 833 | {
|
|---|
| 834 | oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),
|
|---|
| 835 | HEAP_ZERO_MEMORY,
|
|---|
| 836 | uni->Length/2)+1;
|
|---|
| 837 | oem->MaximumLength = uni->Length/2+1;
|
|---|
| 838 | }
|
|---|
| 839 |
|
|---|
| 840 | oem->Length = uni->Length/2;
|
|---|
| 841 | lstrcpynWtoA(oem->Buffer,
|
|---|
| 842 | uni->Buffer,
|
|---|
| 843 | uni->Length/2+1);
|
|---|
| 844 |
|
|---|
| 845 | return 0;
|
|---|
| 846 | }
|
|---|
| 847 |
|
|---|
| 848 | /**************************************************************************
|
|---|
| 849 | * RtlNtStatusToDosErro [NTDLL]
|
|---|
| 850 | */
|
|---|
| 851 | DWORD WIN32API RtlNtStatusToDosError(DWORD error)
|
|---|
| 852 | {
|
|---|
| 853 | dprintf(("NTDLL: RtlNtStatusToDosErro(%08x) not implemented properly.\n",
|
|---|
| 854 | error));
|
|---|
| 855 |
|
|---|
| 856 | /* @@@PH: map STATUS_ to ERROR_ */
|
|---|
| 857 | return error;
|
|---|
| 858 | }
|
|---|
| 859 |
|
|---|
| 860 | /**************************************************************************
|
|---|
| 861 | * RtlGetNtProductType [NTDLL]
|
|---|
| 862 | */
|
|---|
| 863 | DWORD WIN32API RtlGetNtProductType(LPVOID x)
|
|---|
| 864 | {
|
|---|
| 865 | dprintf(("NTDLL: RtlGetNtProductType(%08x) not implemented.\n",
|
|---|
| 866 | x));
|
|---|
| 867 |
|
|---|
| 868 | /* @@@PH : find documentation for this one */
|
|---|
| 869 | return 0;
|
|---|
| 870 | }
|
|---|
| 871 |
|
|---|
| 872 | /**************************************************************************
|
|---|
| 873 | * RtlUpcaseUnicodeString [NTDLL]
|
|---|
| 874 | */
|
|---|
| 875 | DWORD WIN32API RtlUpcaseUnicodeString(PUNICODE_STRING dest,
|
|---|
| 876 | PUNICODE_STRING src,
|
|---|
| 877 | BOOL doalloc)
|
|---|
| 878 | {
|
|---|
| 879 | LPWSTR s;
|
|---|
| 880 | LPWSTR t;
|
|---|
| 881 | DWORD i,len;
|
|---|
| 882 |
|
|---|
| 883 | dprintf(("NTDLL: RtlUpcaseUnicodeString(%08x,%08x,%08x)\n",
|
|---|
| 884 | dest,
|
|---|
| 885 | src,
|
|---|
| 886 | doalloc));
|
|---|
| 887 |
|
|---|
| 888 | len = src->Length;
|
|---|
| 889 | if (doalloc)
|
|---|
| 890 | {
|
|---|
| 891 | dest->MaximumLength = len;
|
|---|
| 892 | dest->Buffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
|
|---|
| 893 | HEAP_ZERO_MEMORY,
|
|---|
| 894 | len);
|
|---|
| 895 | if (!dest->Buffer)
|
|---|
| 896 | return STATUS_NO_MEMORY;
|
|---|
| 897 | }
|
|---|
| 898 |
|
|---|
| 899 | if (dest->MaximumLength < len)
|
|---|
| 900 | return STATUS_BUFFER_OVERFLOW;
|
|---|
| 901 |
|
|---|
| 902 | s=dest->Buffer;
|
|---|
| 903 | t=src->Buffer;
|
|---|
| 904 |
|
|---|
| 905 | /* len is in bytes */
|
|---|
| 906 | for (i=0;
|
|---|
| 907 | i<len/2;
|
|---|
| 908 | i++)
|
|---|
| 909 | s[i]=toupper(t[i]);
|
|---|
| 910 |
|
|---|
| 911 | return STATUS_SUCCESS;
|
|---|
| 912 | }
|
|---|
| 913 |
|
|---|
| 914 | /**************************************************************************
|
|---|
| 915 | * RtlxOemStringToUnicodeSize [NTDLL]
|
|---|
| 916 | */
|
|---|
| 917 | UINT WIN32API RtlxOemStringToUnicodeSize(PSTRING str)
|
|---|
| 918 | {
|
|---|
| 919 | dprintf(("NTDLL: RtlxOemStringToUnicodeSize(%08x)\n",
|
|---|
| 920 | str));
|
|---|
| 921 |
|
|---|
| 922 | return str->Length*2+2;
|
|---|
| 923 | }
|
|---|
| 924 |
|
|---|
| 925 | /**************************************************************************
|
|---|
| 926 | * RtlxAnsiStringToUnicodeSize [NTDLL]
|
|---|
| 927 | */
|
|---|
| 928 | UINT WIN32API RtlxAnsiStringToUnicodeSize(PANSI_STRING str)
|
|---|
| 929 | {
|
|---|
| 930 | dprintf(("NTDLL: RtlxAnsiStringToUnicodeSize(%08x)\n",
|
|---|
| 931 | str));
|
|---|
| 932 |
|
|---|
| 933 | return str->Length*2+2;
|
|---|
| 934 | }
|
|---|
| 935 |
|
|---|
| 936 | /**************************************************************************
|
|---|
| 937 | * RtlDosPathNameToNtPathName_U [NTDLL]
|
|---|
| 938 | *
|
|---|
| 939 | * FIXME: convert to UNC or whatever is expected here
|
|---|
| 940 | */
|
|---|
| 941 | BOOL WIN32API RtlDosPathNameToNtPathName_U(
|
|---|
| 942 | LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3)
|
|---|
| 943 | {
|
|---|
| 944 | LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),
|
|---|
| 945 | 0,
|
|---|
| 946 | from);
|
|---|
| 947 |
|
|---|
| 948 | dprintf(("NTDLL: RtlDosPathNameToNtPathName_U(%s,%p,%08lx,%08lx)\n",
|
|---|
| 949 | fromA,
|
|---|
| 950 | us,
|
|---|
| 951 | x2,
|
|---|
| 952 | x3));
|
|---|
| 953 |
|
|---|
| 954 | if (us)
|
|---|
| 955 | RtlInitUnicodeString(us,
|
|---|
| 956 | HEAP_strdupW(GetProcessHeap(),
|
|---|
| 957 | 0,
|
|---|
| 958 | from));
|
|---|
| 959 |
|
|---|
| 960 | return TRUE;
|
|---|
| 961 | }
|
|---|
| 962 |
|
|---|
| 963 | /**************************************************************************
|
|---|
| 964 | * NtOpenFile [NTDLL]
|
|---|
| 965 | */
|
|---|
| 966 | DWORD WIN32API NtOpenFile(DWORD x1,
|
|---|
| 967 | DWORD flags,
|
|---|
| 968 | DWORD x3,
|
|---|
| 969 | DWORD x4,
|
|---|
| 970 | DWORD alignment,
|
|---|
| 971 | DWORD x6)
|
|---|
| 972 | {
|
|---|
| 973 | dprintf(("NTDLL: NtOpenFile (%08lx,%08lx,%08lx,%08lx,%08lx,%08lx) not implemented\n",
|
|---|
| 974 | x1,
|
|---|
| 975 | flags,
|
|---|
| 976 | x3,
|
|---|
| 977 | x4,
|
|---|
| 978 | alignment,
|
|---|
| 979 | x6));
|
|---|
| 980 |
|
|---|
| 981 | /* returns file io completion status */
|
|---|
| 982 | return 0;
|
|---|
| 983 | }
|
|---|
| 984 |
|
|---|
| 985 |
|
|---|
| 986 | //******************************************************************************
|
|---|
| 987 | //NtClose has to call CloseHandle since the Handlemanager has to be
|
|---|
| 988 | //called.
|
|---|
| 989 | //******************************************************************************
|
|---|
| 990 | DWORD WIN32API NtClose(HANDLE hHandle)
|
|---|
| 991 | {
|
|---|
| 992 | dprintf(("KERNEL32: NtClose(%08x) not properly implemented.\n",
|
|---|
| 993 | hHandle));
|
|---|
| 994 |
|
|---|
| 995 | /* @@@PH 98/05/05 function from NTDLL */
|
|---|
| 996 | return (CloseHandle(hHandle));
|
|---|
| 997 | }
|
|---|
| 998 |
|
|---|
| 999 |
|
|---|
| 1000 | //******************************************************************************
|
|---|
| 1001 | //TODO: What's this? (not found in SDK)
|
|---|
| 1002 | //******************************************************************************
|
|---|
| 1003 | HANDLE WIN32API RtlOpenCurrentUser(ULONG ulDummy1,
|
|---|
| 1004 | ULONG ulDummy2)
|
|---|
| 1005 | {
|
|---|
| 1006 | dprintf(("KERNEL32: RtlOpenCurrentUser(%08x, %08x) not implemented.\n",
|
|---|
| 1007 | ulDummy1,
|
|---|
| 1008 | ulDummy2));
|
|---|
| 1009 |
|
|---|
| 1010 | /* @@@PH required by NT's MSACM32 */
|
|---|
| 1011 | return (HANDLE)(NULL);
|
|---|
| 1012 | }
|
|---|