Changeset 6712 for trunk/src/shlwapi
- Timestamp:
- Sep 15, 2001, 11:47:44 AM (24 years ago)
- Location:
- trunk/src/shlwapi
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shlwapi/ordinal.c
r6650 r6712 1 /* $Id: ordinal.c,v 1.6 2001-09-05 13:48:37 bird Exp $ */2 1 /* 3 2 * SHLWAPI ordinal functions … … 66 65 #ifndef __WIN32OS2__ 67 66 /************************************************************************* 68 * SHLWAPI_1 [SHLWAPI.1]67 * SHLWAPI_1 [SHLWAPI.1] 69 68 */ 70 69 DWORD WINAPI SHLWAPI_1 ( 71 LPSTR lpURL,72 LPDWORD lpdwFlags)70 LPSTR lpURL, 71 LPDWORD lpdwFlags) 73 72 { 74 73 if (lpURL == NULL) 75 74 return E_INVALIDARG; 76 75 77 76 if (lpdwFlags == NULL) 78 77 return E_INVALIDARG; 79 78 80 79 // verify flags 81 80 if (*lpdwFlags != 0x18) // some unknown flag 82 81 return E_INVALIDARG; // some unknown error condition 83 82 84 83 FIXME("(%p %s %p %s)\n",lpStr, debugstr_a(lpStr),x, debugstr_a(x)); 85 84 return 0; … … 87 86 88 87 /************************************************************************* 89 * SHLWAPI_2 [SHLWAPI.2]88 * SHLWAPI_2 [SHLWAPI.2] 90 89 */ 91 90 DWORD WINAPI SHLWAPI_2 (LPCWSTR x,LPVOID y) 92 91 { 93 FIXME("(%s,%p)\n",debugstr_w(x),y);94 return 0;95 } 96 97 /************************************************************************* 98 * SHLWAPI_16 [SHLWAPI.16]92 FIXME("(%s,%p)\n",debugstr_w(x),y); 93 return 0; 94 } 95 96 /************************************************************************* 97 * SHLWAPI_16 [SHLWAPI.16] 99 98 */ 100 99 HRESULT WINAPI SHLWAPI_16 ( 101 LPVOID w,102 LPVOID x,103 LPVOID y,104 LPWSTR z)105 { 106 FIXME("(%p %p %p %p)stub\n",w,x,y,z);107 return 0xabba1252;108 } 109 #endif 110 111 /************************************************************************* 112 * SHLWAPI_23 [SHLWAPI.23]100 LPVOID w, 101 LPVOID x, 102 LPVOID y, 103 LPWSTR z) 104 { 105 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 106 return 0xabba1252; 107 } 108 #endif 109 110 /************************************************************************* 111 * SHLWAPI_23 [SHLWAPI.23] 113 112 * 114 113 * NOTES 115 * converts a guid to a string116 * returns strlen(str)114 * converts a guid to a string 115 * returns strlen(str) 117 116 */ 118 117 DWORD WINAPI SHLWAPI_23 ( 119 REFGUID guid,/* [in] clsid */120 LPSTR str,/* [out] buffer */121 INT cmax)/* [in] size of buffer */122 { 123 char xguid[40];118 REFGUID guid, /* [in] clsid */ 119 LPSTR str, /* [out] buffer */ 120 INT cmax) /* [in] size of buffer */ 121 { 122 char xguid[40]; 124 123 125 124 sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", … … 127 126 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], 128 127 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] ); 129 TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax);130 if (strlen(xguid)>=cmax) return 0;131 strcpy(str,xguid);132 return strlen(xguid) + 1;133 } 134 135 /************************************************************************* 136 * SHLWAPI_24 [SHLWAPI.24]128 TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax); 129 if (strlen(xguid)>=cmax) return 0; 130 strcpy(str,xguid); 131 return strlen(xguid) + 1; 132 } 133 134 /************************************************************************* 135 * SHLWAPI_24 [SHLWAPI.24] 137 136 * 138 137 * NOTES 139 * converts a guid to a string140 * returns strlen(str)138 * converts a guid to a string 139 * returns strlen(str) 141 140 */ 142 141 DWORD WINAPI SHLWAPI_24 ( 143 REFGUID guid,/* [in] clsid */144 LPWSTR str,/* [out] buffer */145 INT cmax)/* [in] size of buffer */142 REFGUID guid, /* [in] clsid */ 143 LPWSTR str, /* [out] buffer */ 144 INT cmax) /* [in] size of buffer */ 146 145 { 147 146 char xguid[40]; … … 155 154 156 155 /************************************************************************* 157 * SHLWAPI_30 [SHLWAPI.30]156 * SHLWAPI_30 [SHLWAPI.30] 158 157 * 159 158 * Seems to be an isspaceW. … … 174 173 175 174 /************************************************************************* 176 * SHLWAPI_32 [SHLWAPI.32]175 * SHLWAPI_32 [SHLWAPI.32] 177 176 */ 178 177 BOOL WINAPI SHLWAPI_32(LPCWSTR lpcChar) … … 188 187 189 188 /************************************************************************* 190 * SHLWAPI_40 [SHLWAPI.40]189 * SHLWAPI_40 [SHLWAPI.40] 191 190 * 192 191 * Get pointer to next Unicode character. … … 198 197 199 198 /************************************************************************* 200 * SHLWAPI_74 [SHLWAPI.74]199 * SHLWAPI_74 [SHLWAPI.74] 201 200 * 202 201 * Get the text from a given dialog item. … … 213 212 } 214 213 /************************************************************************* 215 * SHLWAPI_151 [SHLWAPI.151]214 * SHLWAPI_151 [SHLWAPI.151] 216 215 */ 217 216 #ifdef __WIN32OS2__ … … 239 238 240 239 /************************************************************************* 241 * SHLWAPI_152 [SHLWAPI.152]240 * SHLWAPI_152 [SHLWAPI.152] 242 241 */ 243 242 DWORD WINAPI SHLWAPI_152(LPWSTR str1, LPWSTR str2, INT len) … … 255 254 256 255 /************************************************************************* 257 * SHLWAPI_153 [SHLWAPI.153]256 * SHLWAPI_153 [SHLWAPI.153] 258 257 */ 259 258 #ifdef __WIN32OS2__ … … 285 284 286 285 /************************************************************************* 287 * SHLWAPI_156 [SHLWAPI.156]288 * 289 * Case sensitive string compare. Does not SetLastError().286 * SHLWAPI_156 [SHLWAPI.156] 287 * 288 * Case sensitive string compare. Does not SetLastError(). 290 289 */ 291 290 DWORD WINAPI SHLWAPI_156 ( LPWSTR str1, LPWSTR str2) … … 296 295 297 296 /************************************************************************* 298 * SHLWAPI_162 [SHLWAPI.162]297 * SHLWAPI_162 [SHLWAPI.162] 299 298 * 300 299 * Ensure a multibyte character string doesn't end in a hanging lead byte. … … 320 319 321 320 /************************************************************************* 322 * SHLWAPI_165 [SHLWAPI.165]321 * SHLWAPI_165 [SHLWAPI.165] 323 322 * 324 323 * SetWindowLongA with mask. … … 335 334 336 335 /************************************************************************* 337 * SHLWAPI_169 [SHLWAPI.169]336 * SHLWAPI_169 [SHLWAPI.169] 338 337 */ 339 338 DWORD WINAPI SHLWAPI_169 (IUnknown * lpUnknown) 340 339 { 341 TRACE("(%p)\n",lpUnknown);340 TRACE("(%p)\n",lpUnknown); 342 341 #if 0 343 if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0;344 return IUnknown_Release(lpUnknown);345 #endif 346 return 0;347 } 348 349 /************************************************************************* 350 * SHLWAPI_170 [SHLWAPI.170]342 if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0; 343 return IUnknown_Release(lpUnknown); 344 #endif 345 return 0; 346 } 347 348 /************************************************************************* 349 * SHLWAPI_170 [SHLWAPI.170] 351 350 * 352 351 * Skip URL '//' sequence. … … 360 359 361 360 /************************************************************************* 362 * SHLWAPI_181 [SHLWAPI.181]363 * 364 * Enable or disable a menu item.361 * SHLWAPI_181 [SHLWAPI.181] 362 * 363 * Enable or disable a menu item. 365 364 */ 366 365 UINT WINAPI SHLWAPI_181(HMENU hMenu, UINT wItemID, BOOL bEnable) … … 370 369 371 370 /************************************************************************* 372 * SHLWAPI_183 [SHLWAPI.183]371 * SHLWAPI_183 [SHLWAPI.183] 373 372 * 374 373 * Register a window class if it isn't already. … … 383 382 384 383 /************************************************************************* 385 * SHLWAPI_193 [SHLWAPI.193]384 * SHLWAPI_193 [SHLWAPI.193] 386 385 */ 387 386 DWORD WINAPI SHLWAPI_193 () 388 387 { 389 HDC hdc;390 DWORD ret;391 392 TRACE("()\n");393 394 hdc = GetDC(0);395 ret = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);396 ReleaseDC(0, hdc);397 return ret;398 } 399 400 /************************************************************************* 401 * SHLWAPI_215 [SHLWAPI.215]388 HDC hdc; 389 DWORD ret; 390 391 TRACE("()\n"); 392 393 hdc = GetDC(0); 394 ret = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES); 395 ReleaseDC(0, hdc); 396 return ret; 397 } 398 399 /************************************************************************* 400 * SHLWAPI_215 [SHLWAPI.215] 402 401 * 403 402 * NOTES … … 405 404 */ 406 405 LPWSTR WINAPI SHLWAPI_215 ( 407 LPWSTR lpStrSrc,408 LPVOID lpwStrDest,409 int len)410 { 411 WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len);412 return strncpyW(lpwStrDest, lpStrSrc, len);413 } 414 415 /************************************************************************* 416 * SHLWAPI_218 [SHLWAPI.218]406 LPWSTR lpStrSrc, 407 LPVOID lpwStrDest, 408 int len) 409 { 410 WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len); 411 return strncpyW(lpwStrDest, lpStrSrc, len); 412 } 413 414 /************************************************************************* 415 * SHLWAPI_218 [SHLWAPI.218] 417 416 * 418 417 * WideCharToMultiByte with multi language support. … … 508 507 509 508 /************************************************************************* 510 * SHLWAPI_217 [SHLWAPI.217]509 * SHLWAPI_217 [SHLWAPI.217] 511 510 * 512 511 */ … … 518 517 #ifndef __WIN32OS2__ 519 518 /************************************************************************* 520 * SHLWAPI_219 [SHLWAPI.219]519 * SHLWAPI_219 [SHLWAPI.219] 521 520 * 522 521 * NOTES … … 524 523 */ 525 524 HRESULT WINAPI SHLWAPI_219 ( 526 LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */527 LPVOID x,528 REFIID riid,529 LPWSTR z) /* [???] NOTE: OUT: path */530 { 531 FIXME("(%p %p %s %p)stub\n",w,x,debugstr_guid(riid),z);532 return 0xabba1252;533 } 534 #endif 535 536 /************************************************************************* 537 * SHLWAPI_222 [SHLWAPI.222]525 LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */ 526 LPVOID x, 527 REFIID riid, 528 LPWSTR z) /* [???] NOTE: OUT: path */ 529 { 530 FIXME("(%p %p %s %p)stub\n",w,x,debugstr_guid(riid),z); 531 return 0xabba1252; 532 } 533 #endif 534 535 /************************************************************************* 536 * SHLWAPI_222 [SHLWAPI.222] 538 537 * 539 538 * NOTES … … 542 541 HANDLE WINAPI SHLWAPI_222 (LPCLSID guid) 543 542 { 544 char lpstrName[80];543 char lpstrName[80]; 545 544 546 545 sprintf( lpstrName, "shell.{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", … … 548 547 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], 549 548 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] ); 550 FIXME("(%s) stub\n", lpstrName);551 return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName);552 } 553 554 /************************************************************************* 555 * SHLWAPI_223 [SHLWAPI.223]549 FIXME("(%s) stub\n", lpstrName); 550 return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName); 551 } 552 553 /************************************************************************* 554 * SHLWAPI_223 [SHLWAPI.223] 556 555 * 557 556 * NOTES … … 560 559 DWORD WINAPI SHLWAPI_223 (HANDLE handle) 561 560 { 562 DWORD oldCount;563 564 FIXME("(0x%08x) stub\n",handle);565 566 ReleaseSemaphore( handle, 1, &oldCount);/* +1 */567 WaitForSingleObject( handle, 0 );/* -1 */568 return oldCount;569 } 570 571 /************************************************************************* 572 * SHLWAPI_237 [SHLWAPI.237]561 DWORD oldCount; 562 563 FIXME("(0x%08x) stub\n",handle); 564 565 ReleaseSemaphore( handle, 1, &oldCount); /* +1 */ 566 WaitForSingleObject( handle, 0 ); /* -1 */ 567 return oldCount; 568 } 569 570 /************************************************************************* 571 * SHLWAPI_237 [SHLWAPI.237] 573 572 * 574 573 * Unicode version of SHLWAPI_183. … … 576 575 DWORD WINAPI SHLWAPI_237 (WNDCLASSW * lpWndClass) 577 576 { 578 WNDCLASSW WndClass;579 580 TRACE("(0x%08x %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName));581 582 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass))583 return TRUE;584 return RegisterClassW(lpWndClass);585 } 586 587 /************************************************************************* 588 * SHLWAPI_240 [SHLWAPI.240]589 * 590 * Calls ASCII or Unicode WindowProc for the given window.577 WNDCLASSW WndClass; 578 579 TRACE("(0x%08x %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName)); 580 581 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass)) 582 return TRUE; 583 return RegisterClassW(lpWndClass); 584 } 585 586 /************************************************************************* 587 * SHLWAPI_240 [SHLWAPI.240] 588 * 589 * Calls ASCII or Unicode WindowProc for the given window. 591 590 */ 592 591 LRESULT CALLBACK SHLWAPI_240(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) 593 592 { 594 if (IsWindowUnicode(hWnd))595 return DefWindowProcW(hWnd, uMessage, wParam, lParam);596 return DefWindowProcA(hWnd, uMessage, wParam, lParam);593 if (IsWindowUnicode(hWnd)) 594 return DefWindowProcW(hWnd, uMessage, wParam, lParam); 595 return DefWindowProcA(hWnd, uMessage, wParam, lParam); 597 596 } 598 597 #ifndef __WIN32OS2__ 599 598 /************************************************************************* 600 * SHLWAPI_241 [SHLWAPI.241]599 * SHLWAPI_241 [SHLWAPI.241] 601 600 * 602 601 */ 603 602 DWORD WINAPI SHLWAPI_241 () 604 603 { 605 FIXME("()stub\n");606 return 0xabba1243;607 } 608 609 /************************************************************************* 610 * SHLWAPI_266 [SHLWAPI.266]604 FIXME("()stub\n"); 605 return 0xabba1243; 606 } 607 608 /************************************************************************* 609 * SHLWAPI_266 [SHLWAPI.266] 611 610 */ 612 611 DWORD WINAPI SHLWAPI_266 ( 613 LPVOID w,614 LPVOID x,615 LPVOID y,616 LPVOID z)617 { 618 FIXME("(%p %p %p %p)stub\n",w,x,y,z);619 return 0xabba1248;620 } 621 622 /************************************************************************* 623 * SHLWAPI_267 [SHLWAPI.267]612 LPVOID w, 613 LPVOID x, 614 LPVOID y, 615 LPVOID z) 616 { 617 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 618 return 0xabba1248; 619 } 620 621 /************************************************************************* 622 * SHLWAPI_267 [SHLWAPI.267] 624 623 */ 625 624 HRESULT WINAPI SHLWAPI_267 ( 626 LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */627 LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */628 LPVOID y,629 LPVOID z)630 { 631 FIXME("(%p %p %p %p)stub\n",w,x,y,z);632 *((LPDWORD)z) = 0xabba1200;633 return 0xabba1254;634 } 635 636 /************************************************************************* 637 * SHLWAPI_268 [SHLWAPI.268]625 LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */ 626 LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */ 627 LPVOID y, 628 LPVOID z) 629 { 630 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 631 *((LPDWORD)z) = 0xabba1200; 632 return 0xabba1254; 633 } 634 635 /************************************************************************* 636 * SHLWAPI_268 [SHLWAPI.268] 638 637 */ 639 638 DWORD WINAPI SHLWAPI_268 ( 640 LPVOID w,641 LPVOID x)642 { 643 FIXME("(%p %p)\n",w,x);644 return 0xabba1251; /* 0 = failure */645 } 646 647 /************************************************************************* 648 * SHLWAPI_276 [SHLWAPI.276]639 LPVOID w, 640 LPVOID x) 641 { 642 FIXME("(%p %p)\n",w,x); 643 return 0xabba1251; /* 0 = failure */ 644 } 645 646 /************************************************************************* 647 * SHLWAPI_276 [SHLWAPI.276] 649 648 * 650 649 */ 651 650 DWORD WINAPI SHLWAPI_276 () 652 651 { 653 FIXME("()stub\n");654 return 0xabba1244;655 } 656 #endif 657 /************************************************************************* 658 * SHLWAPI_278 [SHLWAPI.278]652 FIXME("()stub\n"); 653 return 0xabba1244; 654 } 655 #endif 656 /************************************************************************* 657 * SHLWAPI_278 [SHLWAPI.278] 659 658 * 660 659 */ 661 660 DWORD WINAPI SHLWAPI_278 ( 662 LONG wndProc,663 HWND hWndParent,664 DWORD dwExStyle,665 DWORD dwStyle,666 HMENU hMenu,667 LONG z)668 { 669 WNDCLASSA wndclass;670 HWND hwnd;671 HCURSOR hCursor;672 char * clsname = "WorkerA";673 674 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n",675 wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z);676 677 hCursor = LoadCursorA(0x00000000,IDC_ARROWA);678 679 if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass))680 {681 RtlZeroMemory(&wndclass, sizeof(WNDCLASSA));682 wndclass.lpfnWndProc = DefWindowProcW;683 wndclass.cbWndExtra = 4;684 wndclass.hInstance = shlwapi_hInstance;685 wndclass.hCursor = hCursor;686 wndclass.hbrBackground = COLOR_BTNSHADOW;687 wndclass.lpszMenuName = NULL;688 wndclass.lpszClassName = clsname;689 RegisterClassA (&wndclass);690 }691 hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent,692 hMenu,shlwapi_hInstance,0);693 SetWindowLongA(hwnd, 0, z);694 SetWindowLongA(hwnd, GWL_WNDPROC, wndProc);695 return hwnd;696 } 697 698 /************************************************************************* 699 * SHLWAPI_289 [SHLWAPI.289]661 LONG wndProc, 662 HWND hWndParent, 663 DWORD dwExStyle, 664 DWORD dwStyle, 665 HMENU hMenu, 666 LONG z) 667 { 668 WNDCLASSA wndclass; 669 HWND hwnd; 670 HCURSOR hCursor; 671 char * clsname = "WorkerA"; 672 673 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n", 674 wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z); 675 676 hCursor = LoadCursorA(0x00000000,IDC_ARROWA); 677 678 if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass)) 679 { 680 RtlZeroMemory(&wndclass, sizeof(WNDCLASSA)); 681 wndclass.lpfnWndProc = DefWindowProcW; 682 wndclass.cbWndExtra = 4; 683 wndclass.hInstance = shlwapi_hInstance; 684 wndclass.hCursor = hCursor; 685 wndclass.hbrBackground = COLOR_BTNSHADOW; 686 wndclass.lpszMenuName = NULL; 687 wndclass.lpszClassName = clsname; 688 RegisterClassA (&wndclass); 689 } 690 hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent, 691 hMenu,shlwapi_hInstance,0); 692 SetWindowLongA(hwnd, 0, z); 693 SetWindowLongA(hwnd, GWL_WNDPROC, wndProc); 694 return hwnd; 695 } 696 697 /************************************************************************* 698 * SHLWAPI_289 [SHLWAPI.289] 700 699 * 701 700 * Late bound call to winmm.PlaySoundW … … 710 709 711 710 /************************************************************************* 712 * SHLWAPI_313 [SHLWAPI.313]711 * SHLWAPI_313 [SHLWAPI.313] 713 712 * 714 713 * Late bound call to shell32.SHGetFileInfoW … … 724 723 725 724 /************************************************************************* 726 * SHLWAPI_318 [SHLWAPI.318]725 * SHLWAPI_318 [SHLWAPI.318] 727 726 * 728 727 * Late bound call to shell32.DragQueryFileW … … 737 736 738 737 /************************************************************************* 739 * SHLWAPI_333 [SHLWAPI.333]738 * SHLWAPI_333 [SHLWAPI.333] 740 739 * 741 740 * Late bound call to shell32.SHBrowseForFolderW … … 750 749 751 750 /************************************************************************* 752 * SHLWAPI_334 [SHLWAPI.334]751 * SHLWAPI_334 [SHLWAPI.334] 753 752 * 754 753 * Late bound call to shell32.SHGetPathFromIDListW … … 763 762 764 763 /************************************************************************* 765 * SHLWAPI_335 [SHLWAPI.335]764 * SHLWAPI_335 [SHLWAPI.335] 766 765 * 767 766 * Late bound call to shell32.ShellExecuteExW … … 776 775 777 776 /************************************************************************* 778 * SHLWAPI_336 [SHLWAPI.336]777 * SHLWAPI_336 [SHLWAPI.336] 779 778 * 780 779 * Late bound call to shell32.SHFileOperationW. … … 789 788 790 789 /************************************************************************* 791 * SHLWAPI_337 [SHLWAPI.337]790 * SHLWAPI_337 [SHLWAPI.337] 792 791 * 793 792 * Late bound call to shell32.ExtractIconExW. … … 804 803 //Bugbug: is forwarder for InterlockedCompareExchange 805 804 /************************************************************************* 806 * SHLWAPI_342 [SHLWAPI.342]805 * SHLWAPI_342 [SHLWAPI.342] 807 806 * 808 807 */ 809 808 DWORD WINAPI SHLWAPI_342 ( 810 LPVOID w,811 LPVOID x,812 LPVOID y,813 LPVOID z)814 { 815 FIXME("(%p %p %p %p)stub\n",w,x,y,z);816 return 0xabba1249;817 } 818 #endif 819 /************************************************************************* 820 * SHLWAPI_346 [SHLWAPI.346]809 LPVOID w, 810 LPVOID x, 811 LPVOID y, 812 LPVOID z) 813 { 814 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 815 return 0xabba1249; 816 } 817 #endif 818 /************************************************************************* 819 * SHLWAPI_346 [SHLWAPI.346] 821 820 */ 822 821 DWORD WINAPI SHLWAPI_346 ( 823 LPCWSTR src,824 LPWSTR dest,825 int len)826 { 827 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src),dest,len);828 lstrcpynW(dest, src, len);829 return lstrlenW(dest)+1;830 } 831 832 /************************************************************************* 833 * SHLWAPI_357 [SHLWAPI.357]822 LPCWSTR src, 823 LPWSTR dest, 824 int len) 825 { 826 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src),dest,len); 827 lstrcpynW(dest, src, len); 828 return lstrlenW(dest)+1; 829 } 830 831 /************************************************************************* 832 * SHLWAPI_357 [SHLWAPI.357] 834 833 * 835 834 * Late bound call to shell32.SHGetNewLinkInfoW … … 845 844 846 845 /************************************************************************* 847 * SHLWAPI_358 [SHLWAPI.358]846 * SHLWAPI_358 [SHLWAPI.358] 848 847 * 849 848 * Late bound call to shell32.SHDefExtractIconW … … 860 859 861 860 /************************************************************************* 862 * SHLWAPI_364 [SHLWAPI.364]861 * SHLWAPI_364 [SHLWAPI.364] 863 862 * 864 863 * Wrapper for lstrcpynA with src and dst swapped. … … 871 870 872 871 /************************************************************************* 873 * SHLWAPI_370 [SHLWAPI.370]872 * SHLWAPI_370 [SHLWAPI.370] 874 873 * 875 874 * Late bound call to shell32.ExtractIconW … … 885 884 886 885 /************************************************************************* 887 * SHLWAPI_376 [SHLWAPI.376]886 * SHLWAPI_376 [SHLWAPI.376] 888 887 */ 889 888 DWORD WINAPI SHLWAPI_376 (LONG x) 890 889 { 891 FIXME("(0x%08lx)stub\n", x );890 FIXME("(0x%08lx)stub\n", x ); 892 891 /* FIXME: This should be a forward in the .spec file to the win2k function 893 892 * kernel32.GetUserDefaultUILanguage, however that function isn't there yet. … … 897 896 #ifndef __WIN32OS2__ 898 897 /************************************************************************* 899 * SHLWAPI_377 [SHLWAPI.377]898 * SHLWAPI_377 [SHLWAPI.377] 900 899 */ 901 900 DWORD WINAPI SHLWAPI_377 (LPVOID x, LPVOID y, LPVOID z) 902 901 { 903 FIXME("(%p %p %p)stub\n", x,y,z);904 return 0xabba1246;905 } 906 #endif 907 /************************************************************************* 908 * SHLWAPI_378 [SHLWAPI.378]902 FIXME("(%p %p %p)stub\n", x,y,z); 903 return 0xabba1246; 904 } 905 #endif 906 /************************************************************************* 907 * SHLWAPI_378 [SHLWAPI.378] 909 908 */ 910 909 DWORD WINAPI SHLWAPI_378 ( 911 LPSTR x,912 LPVOID y, /* [???] 0x50000000 */913 LPVOID z) /* [???] 4 */914 { 915 FIXME("(%s %p %p)stub\n", x,y,z);916 return LoadLibraryA(x);917 } 918 919 /************************************************************************* 920 * SHLWAPI_389 [SHLWAPI.389]910 LPSTR x, 911 LPVOID y, /* [???] 0x50000000 */ 912 LPVOID z) /* [???] 4 */ 913 { 914 FIXME("(%s %p %p)stub\n", x,y,z); 915 return LoadLibraryA(x); 916 } 917 918 /************************************************************************* 919 * SHLWAPI_389 [SHLWAPI.389] 921 920 * 922 921 * Late bound call to comdlg32.GetSaveFileNameW … … 931 930 932 931 /************************************************************************* 933 * SHLWAPI_390 [SHLWAPI.390]932 * SHLWAPI_390 [SHLWAPI.390] 934 933 * 935 934 * Late bound call to mpr.WNetRestoreConnectionW … … 945 944 946 945 /************************************************************************* 947 * SHLWAPI_391 [SHLWAPI.391]946 * SHLWAPI_391 [SHLWAPI.391] 948 947 * 949 948 * Late bound call to mpr.WNetGetLastErrorW … … 960 959 961 960 /************************************************************************* 962 * SHLWAPI_401 [SHLWAPI.401]961 * SHLWAPI_401 [SHLWAPI.401] 963 962 * 964 963 * Late bound call to comdlg32.PageSetupDlgW … … 973 972 974 973 /************************************************************************* 975 * SHLWAPI_402 [SHLWAPI.402]974 * SHLWAPI_402 [SHLWAPI.402] 976 975 * 977 976 * Late bound call to comdlg32.PrintDlgW … … 986 985 987 986 /************************************************************************* 988 * SHLWAPI_403 [SHLWAPI.403]987 * SHLWAPI_403 [SHLWAPI.403] 989 988 * 990 989 * Late bound call to comdlg32.GetOpenFileNameW … … 1017 1016 1018 1017 /************************************************************************* 1019 * ColorHLSToRGB [SHLWAPI.404]1018 * ColorHLSToRGB [SHLWAPI.404] 1020 1019 * 1021 1020 * Convert from HLS color space into an RGB COLORREF. … … 1051 1050 1052 1051 /************************************************************************* 1053 * SHLWAPI_431 [SHLWAPI.431]1052 * SHLWAPI_431 [SHLWAPI.431] 1054 1053 */ 1055 1054 DWORD WINAPI SHLWAPI_431 (DWORD x) 1056 1055 { 1057 FIXME("(0x%08lx)stub\n", x);1058 return 0xabba1247;1056 FIXME("(0x%08lx)stub\n", x); 1057 return 0xabba1247; 1059 1058 } 1060 1059 1061 1060 #ifndef __WIN32OS2__ 1062 1061 /************************************************************************* 1063 * SHLWAPI_437 [SHLWAPI.437]1062 * SHLWAPI_437 [SHLWAPI.437] 1064 1063 * 1065 1064 * NOTES … … 1074 1073 DWORD WINAPI SHLWAPI_437 (DWORD functionToCall) 1075 1074 { 1076 FIXME("(0x%08lx)stub\n", functionToCall);1077 return 0xabba1247;1078 } 1079 #endif 1080 1081 /************************************************************************* 1082 * SHCreateShellPalette [SHLWAPI.@]1075 FIXME("(0x%08lx)stub\n", functionToCall); 1076 return 0xabba1247; 1077 } 1078 #endif 1079 1080 /************************************************************************* 1081 * SHCreateShellPalette [SHLWAPI.@] 1083 1082 */ 1084 1083 HPALETTE WINAPI SHCreateShellPalette(HDC hdc) 1085 1084 { 1086 FIXME("stub\n");1087 return CreateHalftonePalette(hdc);1088 } 1089 1090 /************************************************************************* 1091 * SHGetInverseCMAP1085 FIXME("stub\n"); 1086 return CreateHalftonePalette(hdc); 1087 } 1088 1089 /************************************************************************* 1090 * SHGetInverseCMAP 1092 1091 */ 1093 1092 DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why) 1094 1093 { 1095 FIXME("(%p, %#lx)stub\n", x, why);1096 return 0;1094 FIXME("(%p, %#lx)stub\n", x, why); 1095 return 0; 1097 1096 } 1098 1097 #ifndef __WIN32OS2__ 1099 1098 /************************************************************************* 1100 * SHIsLowMemoryMachine [SHLWAPI.@]1099 * SHIsLowMemoryMachine [SHLWAPI.@] 1101 1100 */ 1102 1101 DWORD WINAPI SHIsLowMemoryMachine (DWORD x) 1103 1102 { 1104 FIXME("0x%08lx\n", x);1105 return 0;1106 } 1107 #endif 1108 1109 /************************************************************************* 1110 * GetMenuPosFromID [SHLWAPI.@]1103 FIXME("0x%08lx\n", x); 1104 return 0; 1105 } 1106 #endif 1107 1108 /************************************************************************* 1109 * GetMenuPosFromID [SHLWAPI.@] 1111 1110 */ 1112 1111 INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID) … … 1126 1125 1127 1126 /************************************************************************* 1128 * _SHGetInstanceExplorer [SHLWAPI.@]1127 * _SHGetInstanceExplorer [SHLWAPI.@] 1129 1128 * 1130 1129 * Late bound call to shell32.SHGetInstanceExplorer. -
trunk/src/shlwapi/path.c
r6650 r6712 1 /* $Id: path.c,v 1.14 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 2 * Path Functions … … 43 42 #define isSlash(x) ((x)=='\\' || (x)=='/') 44 43 /* 45 ########## Combining and Constructing paths ##########44 ########## Combining and Constructing paths ########## 46 45 */ 47 46 48 47 /************************************************************************* 49 * PathAppendA [SHLWAPI.@]50 * 48 * PathAppendA [SHLWAPI.@] 49 * 51 50 * NOTES 52 51 * concat path lpszPath2 onto lpszPath1 … … 56 55 */ 57 56 BOOL WINAPI PathAppendA( 58 LPSTR lpszPath1,59 LPCSTR lpszPath2) 60 { 61 TRACE("%s %s\n",lpszPath1, lpszPath2);62 while (lpszPath2[0]=='\\') lpszPath2++;63 PathCombineA(lpszPath1,lpszPath1,lpszPath2);64 return TRUE;65 } 66 67 /************************************************************************* 68 * PathAppendW [SHLWAPI.@]57 LPSTR lpszPath1, 58 LPCSTR lpszPath2) 59 { 60 TRACE("%s %s\n",lpszPath1, lpszPath2); 61 while (lpszPath2[0]=='\\') lpszPath2++; 62 PathCombineA(lpszPath1,lpszPath1,lpszPath2); 63 return TRUE; 64 } 65 66 /************************************************************************* 67 * PathAppendW [SHLWAPI.@] 69 68 */ 70 69 BOOL WINAPI PathAppendW( 71 LPWSTR lpszPath1,72 LPCWSTR lpszPath2) 73 { 74 TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2));75 while (lpszPath2[0]=='\\') lpszPath2++;76 PathCombineW(lpszPath1,lpszPath1,lpszPath2);77 return TRUE;78 } 79 80 /************************************************************************* 81 * PathCombineA [SHLWAPI.@]82 * 70 LPWSTR lpszPath1, 71 LPCWSTR lpszPath2) 72 { 73 TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2)); 74 while (lpszPath2[0]=='\\') lpszPath2++; 75 PathCombineW(lpszPath1,lpszPath1,lpszPath2); 76 return TRUE; 77 } 78 79 /************************************************************************* 80 * PathCombineA [SHLWAPI.@] 81 * 83 82 * NOTES 84 83 * if lpszFile='.' skip it … … 89 88 */ 90 89 LPSTR WINAPI PathCombineA( 91 LPSTR szDest,92 LPCSTR lpszDir,93 LPCSTR lpszFile) 94 { 95 char sTemp[MAX_PATH];96 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile);97 98 99 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) ) 100 {101 strcpy(szDest,lpszDir);102 return szDest;103 }104 105 /* if lpszFile is a complete path don't care about lpszDir */106 if (PathGetDriveNumberA(lpszFile) != -1)107 {108 strcpy(szDest,lpszFile);109 }110 else if (lpszFile[0] == '\\' )111 {112 strcpy(sTemp,lpszDir);113 PathStripToRootA(sTemp);114 strcat(sTemp,lpszFile);115 strcpy(szDest,sTemp);116 }117 else118 {119 strcpy(sTemp,lpszDir);120 PathAddBackslashA(sTemp);121 strcat(sTemp,lpszFile);122 strcpy(szDest,sTemp);123 }124 return szDest;125 } 126 127 /************************************************************************* 128 * PathCombineW [SHLWAPI.@]90 LPSTR szDest, 91 LPCSTR lpszDir, 92 LPCSTR lpszFile) 93 { 94 char sTemp[MAX_PATH]; 95 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile); 96 97 98 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) ) 99 { 100 strcpy(szDest,lpszDir); 101 return szDest; 102 } 103 104 /* if lpszFile is a complete path don't care about lpszDir */ 105 if (PathGetDriveNumberA(lpszFile) != -1) 106 { 107 strcpy(szDest,lpszFile); 108 } 109 else if (lpszFile[0] == '\\' ) 110 { 111 strcpy(sTemp,lpszDir); 112 PathStripToRootA(sTemp); 113 strcat(sTemp,lpszFile); 114 strcpy(szDest,sTemp); 115 } 116 else 117 { 118 strcpy(sTemp,lpszDir); 119 PathAddBackslashA(sTemp); 120 strcat(sTemp,lpszFile); 121 strcpy(szDest,sTemp); 122 } 123 return szDest; 124 } 125 126 /************************************************************************* 127 * PathCombineW [SHLWAPI.@] 129 128 */ 130 129 LPWSTR WINAPI PathCombineW( 131 LPWSTR szDest,132 LPCWSTR lpszDir,133 LPCWSTR lpszFile) 134 { 135 WCHAR sTemp[MAX_PATH];136 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),137 lpszFile, debugstr_w(lpszFile));138 139 140 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) 141 {130 LPWSTR szDest, 131 LPCWSTR lpszDir, 132 LPCWSTR lpszFile) 133 { 134 WCHAR sTemp[MAX_PATH]; 135 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir), 136 lpszFile, debugstr_w(lpszFile)); 137 138 139 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) 140 { 142 141 strcpyW(szDest,lpszDir); 143 return szDest;144 }145 146 /* if lpszFile is a complete path don't care about lpszDir */147 if (PathGetDriveNumberW(lpszFile) != -1)148 {142 return szDest; 143 } 144 145 /* if lpszFile is a complete path don't care about lpszDir */ 146 if (PathGetDriveNumberW(lpszFile) != -1) 147 { 149 148 strcpyW(szDest,lpszFile); 150 }151 else if (lpszFile[0] == (WCHAR)'\\' )152 {153 strcpyW(sTemp,lpszDir);154 PathStripToRootW(sTemp);155 strcatW(sTemp,lpszFile);156 strcpyW(szDest,sTemp);157 }158 else159 {160 strcpyW(sTemp,lpszDir);161 PathAddBackslashW(sTemp);162 strcatW(sTemp,lpszFile);163 strcpyW(szDest,sTemp);164 }165 return szDest;166 } 167 168 /************************************************************************* 169 * PathAddBackslashA [SHLWAPI.@]149 } 150 else if (lpszFile[0] == (WCHAR)'\\' ) 151 { 152 strcpyW(sTemp,lpszDir); 153 PathStripToRootW(sTemp); 154 strcatW(sTemp,lpszFile); 155 strcpyW(szDest,sTemp); 156 } 157 else 158 { 159 strcpyW(sTemp,lpszDir); 160 PathAddBackslashW(sTemp); 161 strcatW(sTemp,lpszFile); 162 strcpyW(szDest,sTemp); 163 } 164 return szDest; 165 } 166 167 /************************************************************************* 168 * PathAddBackslashA [SHLWAPI.@] 170 169 * 171 170 * NOTES … … 174 173 LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath) 175 174 { 176 int len;177 TRACE("%p->%s\n",lpszPath,lpszPath);178 179 len = strlen(lpszPath);180 if (len && lpszPath[len-1]!='\\') 181 {182 lpszPath[len] = '\\';183 lpszPath[len+1]= 0x00;184 return lpszPath+len+1;185 }186 return lpszPath+len;187 } 188 189 /************************************************************************* 190 * PathAddBackslashW [SHLWAPI.@]175 int len; 176 TRACE("%p->%s\n",lpszPath,lpszPath); 177 178 len = strlen(lpszPath); 179 if (len && lpszPath[len-1]!='\\') 180 { 181 lpszPath[len] = '\\'; 182 lpszPath[len+1]= 0x00; 183 return lpszPath+len+1; 184 } 185 return lpszPath+len; 186 } 187 188 /************************************************************************* 189 * PathAddBackslashW [SHLWAPI.@] 191 190 */ 192 191 LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath) 193 192 { 194 int len;195 TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath));196 197 len = strlenW(lpszPath);198 if (len && lpszPath[len-1]!=(WCHAR)'\\') 199 {200 lpszPath[len] = (WCHAR)'\\';201 lpszPath[len+1]= 0x00;202 return lpszPath+len+1;203 }204 return lpszPath+len;205 } 206 207 /************************************************************************* 208 * PathBuildRootA [SHLWAPI.@]209 */ 210 LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive) 211 { 212 TRACE("%p %i\n",lpszPath, drive);213 214 strcpy(lpszPath,"A:\\");215 lpszPath[0]+=drive;216 return lpszPath;217 } 218 219 /************************************************************************* 220 * PathBuildRootW [SHLWAPI.@]221 */ 222 LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive) 223 { 224 lpszPath[0] = 'A' + drive;225 lpszPath[1] = ':';226 lpszPath[2] = '\\';227 lpszPath[3] = 0;228 TRACE("%p %i\n",debugstr_w(lpszPath), drive);229 return lpszPath;193 int len; 194 TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath)); 195 196 len = strlenW(lpszPath); 197 if (len && lpszPath[len-1]!=(WCHAR)'\\') 198 { 199 lpszPath[len] = (WCHAR)'\\'; 200 lpszPath[len+1]= 0x00; 201 return lpszPath+len+1; 202 } 203 return lpszPath+len; 204 } 205 206 /************************************************************************* 207 * PathBuildRootA [SHLWAPI.@] 208 */ 209 LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive) 210 { 211 TRACE("%p %i\n",lpszPath, drive); 212 213 strcpy(lpszPath,"A:\\"); 214 lpszPath[0]+=drive; 215 return lpszPath; 216 } 217 218 /************************************************************************* 219 * PathBuildRootW [SHLWAPI.@] 220 */ 221 LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive) 222 { 223 lpszPath[0] = 'A' + drive; 224 lpszPath[1] = ':'; 225 lpszPath[2] = '\\'; 226 lpszPath[3] = 0; 227 TRACE("%p %i\n",debugstr_w(lpszPath), drive); 228 return lpszPath; 230 229 } 231 230 232 231 /* 233 Extracting Component Parts232 Extracting Component Parts 234 233 */ 235 234 236 235 /************************************************************************* 237 * PathFindFileNameA [SHLWAPI.@]236 * PathFindFileNameA [SHLWAPI.@] 238 237 */ 239 238 LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath) 240 239 { 241 LPCSTR lastSlash = lpszPath;242 243 TRACE("%s\n",lpszPath);244 while (*lpszPath) 245 {246 if ( isSlash(lpszPath[0]) && lpszPath[1])247 lastSlash = lpszPath+1;248 lpszPath = CharNextA(lpszPath);249 }250 return (LPSTR)lastSlash;251 252 } 253 254 /************************************************************************* 255 * PathFindFileNameW [SHLWAPI.@]240 LPCSTR lastSlash = lpszPath; 241 242 TRACE("%s\n",lpszPath); 243 while (*lpszPath) 244 { 245 if ( isSlash(lpszPath[0]) && lpszPath[1]) 246 lastSlash = lpszPath+1; 247 lpszPath = CharNextA(lpszPath); 248 } 249 return (LPSTR)lastSlash; 250 251 } 252 253 /************************************************************************* 254 * PathFindFileNameW [SHLWAPI.@] 256 255 */ 257 256 LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath) 258 257 { 259 LPCWSTR wslash;260 wslash = lpszPath;261 262 TRACE("%s\n",debugstr_w(wslash));263 while (lpszPath[0]) 264 {265 if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\')266 wslash = lpszPath+1;267 lpszPath = CharNextW(lpszPath);268 }269 return (LPWSTR)wslash; 270 } 271 272 /************************************************************************* 273 * PathFindExtensionA [SHLWAPI.@]258 LPCWSTR wslash; 259 wslash = lpszPath; 260 261 TRACE("%s\n",debugstr_w(wslash)); 262 while (lpszPath[0]) 263 { 264 if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\') 265 wslash = lpszPath+1; 266 lpszPath = CharNextW(lpszPath); 267 } 268 return (LPWSTR)wslash; 269 } 270 271 /************************************************************************* 272 * PathFindExtensionA [SHLWAPI.@] 274 273 * 275 274 * NOTES … … 277 276 */ 278 277 279 LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath) 280 { 281 LPCSTR lastpoint = NULL;282 283 TRACE("%p %s\n",lpszPath,lpszPath);284 285 while (*lpszPath) 286 {287 if (*lpszPath=='\\'||*lpszPath==' ')288 lastpoint=NULL;289 if (*lpszPath=='.')290 lastpoint=lpszPath;291 lpszPath = CharNextA(lpszPath);292 }293 return (LPSTR)(lastpoint?lastpoint:lpszPath);294 } 295 296 /************************************************************************* 297 * PathFindExtensionW [SHLWAPI.@]298 */ 299 LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath) 300 { 301 LPCWSTR lastpoint = NULL;302 303 TRACE("(%p %s)\n",lpszPath,debugstr_w(lpszPath));304 305 while (*lpszPath)306 {307 if (*lpszPath==(WCHAR)'\\'||*lpszPath==(WCHAR)' ')308 lastpoint=NULL;309 if (*lpszPath==(WCHAR)'.')310 lastpoint=lpszPath;311 lpszPath = CharNextW(lpszPath);312 }313 return (LPWSTR)(lastpoint?lastpoint:lpszPath);314 } 315 316 /************************************************************************* 317 * PathGetArgsA [SHLWAPI.@]278 LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath) 279 { 280 LPCSTR lastpoint = NULL; 281 282 TRACE("%p %s\n",lpszPath,lpszPath); 283 284 while (*lpszPath) 285 { 286 if (*lpszPath=='\\'||*lpszPath==' ') 287 lastpoint=NULL; 288 if (*lpszPath=='.') 289 lastpoint=lpszPath; 290 lpszPath = CharNextA(lpszPath); 291 } 292 return (LPSTR)(lastpoint?lastpoint:lpszPath); 293 } 294 295 /************************************************************************* 296 * PathFindExtensionW [SHLWAPI.@] 297 */ 298 LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath) 299 { 300 LPCWSTR lastpoint = NULL; 301 302 TRACE("(%p %s)\n",lpszPath,debugstr_w(lpszPath)); 303 304 while (*lpszPath) 305 { 306 if (*lpszPath==(WCHAR)'\\'||*lpszPath==(WCHAR)' ') 307 lastpoint=NULL; 308 if (*lpszPath==(WCHAR)'.') 309 lastpoint=lpszPath; 310 lpszPath = CharNextW(lpszPath); 311 } 312 return (LPWSTR)(lastpoint?lastpoint:lpszPath); 313 } 314 315 /************************************************************************* 316 * PathGetArgsA [SHLWAPI.@] 318 317 * 319 318 * NOTES … … 324 323 * quoting by '\' 325 324 */ 326 LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath) 327 { 328 BOOLqflag = FALSE;329 330 TRACE("%s\n",lpszPath);331 332 while (*lpszPath) 333 {334 if ((*lpszPath==' ') && !qflag)335 return (LPSTR)lpszPath+1;336 if (*lpszPath=='"')337 qflag=!qflag;338 lpszPath = CharNextA(lpszPath);339 }340 return (LPSTR)lpszPath;341 } 342 343 /************************************************************************* 344 * PathGetArgsW [SHLWAPI.@]345 */ 346 LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) 347 { 348 BOOLqflag = FALSE;349 350 TRACE("%s\n",debugstr_w(lpszPath));351 352 while (*lpszPath) 353 {354 if ((*lpszPath==' ') && !qflag)355 return (LPWSTR)lpszPath+1;356 if (*lpszPath=='"')357 qflag=!qflag;358 lpszPath = CharNextW(lpszPath);359 }360 return (LPWSTR)lpszPath;361 } 362 363 /************************************************************************* 364 * PathGetDriveNumberA [SHLWAPI.@]325 LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath) 326 { 327 BOOL qflag = FALSE; 328 329 TRACE("%s\n",lpszPath); 330 331 while (*lpszPath) 332 { 333 if ((*lpszPath==' ') && !qflag) 334 return (LPSTR)lpszPath+1; 335 if (*lpszPath=='"') 336 qflag=!qflag; 337 lpszPath = CharNextA(lpszPath); 338 } 339 return (LPSTR)lpszPath; 340 } 341 342 /************************************************************************* 343 * PathGetArgsW [SHLWAPI.@] 344 */ 345 LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) 346 { 347 BOOL qflag = FALSE; 348 349 TRACE("%s\n",debugstr_w(lpszPath)); 350 351 while (*lpszPath) 352 { 353 if ((*lpszPath==' ') && !qflag) 354 return (LPWSTR)lpszPath+1; 355 if (*lpszPath=='"') 356 qflag=!qflag; 357 lpszPath = CharNextW(lpszPath); 358 } 359 return (LPWSTR)lpszPath; 360 } 361 362 /************************************************************************* 363 * PathGetDriveNumberA [SHLWAPI.@] 365 364 */ 366 365 int WINAPI PathGetDriveNumberA(LPCSTR lpszPath) 367 366 { 368 int chr = tolower(lpszPath[0]);369 370 TRACE ("%s\n",debugstr_a(lpszPath));371 372 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;373 return tolower(lpszPath[0]) - 'a' ;374 } 375 376 /************************************************************************* 377 * PathGetDriveNumberW [SHLWAPI.@]367 int chr = tolower(lpszPath[0]); 368 369 TRACE ("%s\n",debugstr_a(lpszPath)); 370 371 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; 372 return tolower(lpszPath[0]) - 'a' ; 373 } 374 375 /************************************************************************* 376 * PathGetDriveNumberW [SHLWAPI.@] 378 377 */ 379 378 int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath) 380 379 { 381 int chr = tolowerW(lpszPath[0]);382 383 TRACE ("%s\n",debugstr_w(lpszPath));384 385 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;386 return tolowerW(lpszPath[0]) - 'a' ;387 } 388 389 /************************************************************************* 390 * PathRemoveFileSpecA [SHLWAPI.@]391 * 380 int chr = tolowerW(lpszPath[0]); 381 382 TRACE ("%s\n",debugstr_w(lpszPath)); 383 384 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; 385 return tolowerW(lpszPath[0]) - 'a' ; 386 } 387 388 /************************************************************************* 389 * PathRemoveFileSpecA [SHLWAPI.@] 390 * 392 391 * NOTES 393 392 * truncates passed argument to a valid path … … 395 394 * "\foo\xx\foo"-> "\foo\xx" 396 395 * "\" -> "\" 397 * "a:\foo" -> "a:\"396 * "a:\foo" -> "a:\" 398 397 */ 399 398 BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath) 400 399 { 401 LPSTR cutplace = lpszPath;402 BOOL ret = FALSE;403 404 TRACE("%s\n",lpszPath);405 406 if(lpszPath)407 {408 while (*lpszPath == '\\') cutplace = ++lpszPath;409 410 while (*lpszPath)411 {412 if(lpszPath[0] == '\\') cutplace = lpszPath;413 414 if(lpszPath[0] == ':')415 {416 cutplace = lpszPath + 1;417 if (lpszPath[1] == '\\') cutplace++;418 lpszPath++;419 }420 lpszPath = CharNextA(lpszPath);421 if (!lpszPath) break;422 }423 424 ret = (*cutplace!='\0');425 *cutplace = '\0';426 }427 return ret;428 } 429 430 /************************************************************************* 431 * PathRemoveFileSpecW [SHLWAPI.@]400 LPSTR cutplace = lpszPath; 401 BOOL ret = FALSE; 402 403 TRACE("%s\n",lpszPath); 404 405 if(lpszPath) 406 { 407 while (*lpszPath == '\\') cutplace = ++lpszPath; 408 409 while (*lpszPath) 410 { 411 if(lpszPath[0] == '\\') cutplace = lpszPath; 412 413 if(lpszPath[0] == ':') 414 { 415 cutplace = lpszPath + 1; 416 if (lpszPath[1] == '\\') cutplace++; 417 lpszPath++; 418 } 419 lpszPath = CharNextA(lpszPath); 420 if (!lpszPath) break; 421 } 422 423 ret = (*cutplace!='\0'); 424 *cutplace = '\0'; 425 } 426 return ret; 427 } 428 429 /************************************************************************* 430 * PathRemoveFileSpecW [SHLWAPI.@] 432 431 */ 433 432 BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath) 434 433 { 435 LPWSTR cutplace = lpszPath;436 BOOL ret = FALSE;437 438 TRACE("%s\n",debugstr_w(lpszPath));439 440 if(lpszPath)441 {442 while (*lpszPath == '\\') cutplace = ++lpszPath;443 444 while (*lpszPath)445 {446 if(lpszPath[0] == '\\') cutplace = lpszPath;447 448 if(lpszPath[0] == ':')449 {450 cutplace = lpszPath + 1;451 if (lpszPath[1] == '\\') cutplace++;452 lpszPath++;453 }454 lpszPath = CharNextW(lpszPath);455 if (!lpszPath) break;456 }457 458 ret = (*cutplace!='\0');459 *cutplace = '\0';460 }461 return ret;462 } 463 464 /************************************************************************* 465 * PathStripPathA [SHELLWAPI.@]466 * 434 LPWSTR cutplace = lpszPath; 435 BOOL ret = FALSE; 436 437 TRACE("%s\n",debugstr_w(lpszPath)); 438 439 if(lpszPath) 440 { 441 while (*lpszPath == '\\') cutplace = ++lpszPath; 442 443 while (*lpszPath) 444 { 445 if(lpszPath[0] == '\\') cutplace = lpszPath; 446 447 if(lpszPath[0] == ':') 448 { 449 cutplace = lpszPath + 1; 450 if (lpszPath[1] == '\\') cutplace++; 451 lpszPath++; 452 } 453 lpszPath = CharNextW(lpszPath); 454 if (!lpszPath) break; 455 } 456 457 ret = (*cutplace!='\0'); 458 *cutplace = '\0'; 459 } 460 return ret; 461 } 462 463 /************************************************************************* 464 * PathStripPathA [SHELLWAPI.@] 465 * 467 466 * NOTES 468 467 * removes the path from the beginning of a filename … … 470 469 void WINAPI PathStripPathA(LPSTR lpszPath) 471 470 { 472 LPSTR lpszFileName = PathFindFileNameA(lpszPath);473 474 TRACE("%s\n", lpszPath);475 476 if(lpszFileName)477 RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)+1); 478 } 479 480 /************************************************************************* 481 * PathStripPathW [SHELLWAPI.@]471 LPSTR lpszFileName = PathFindFileNameA(lpszPath); 472 473 TRACE("%s\n", lpszPath); 474 475 if(lpszFileName) 476 RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)+1); 477 } 478 479 /************************************************************************* 480 * PathStripPathW [SHELLWAPI.@] 482 481 */ 483 482 void WINAPI PathStripPathW(LPWSTR lpszPath) 484 483 { 485 LPWSTR lpszFileName = PathFindFileNameW(lpszPath);486 487 TRACE("%s\n", debugstr_w(lpszPath));488 if(lpszFileName)489 RtlMoveMemory(lpszPath, lpszFileName, (strlenW(lpszFileName)+1)*sizeof(WCHAR)); 490 } 491 492 /************************************************************************* 493 * PathStripToRootA [SHLWAPI.@]484 LPWSTR lpszFileName = PathFindFileNameW(lpszPath); 485 486 TRACE("%s\n", debugstr_w(lpszPath)); 487 if(lpszFileName) 488 RtlMoveMemory(lpszPath, lpszFileName, (strlenW(lpszFileName)+1)*sizeof(WCHAR)); 489 } 490 491 /************************************************************************* 492 * PathStripToRootA [SHLWAPI.@] 494 493 */ 495 494 BOOL WINAPI PathStripToRootA(LPSTR lpszPath) 496 495 { 497 TRACE("%s\n", lpszPath);498 499 if (!lpszPath) return FALSE;500 while(!PathIsRootA(lpszPath))501 if (!PathRemoveFileSpecA(lpszPath)) return FALSE;502 return TRUE;503 } 504 505 /************************************************************************* 506 * PathStripToRootW [SHLWAPI.@]496 TRACE("%s\n", lpszPath); 497 498 if (!lpszPath) return FALSE; 499 while(!PathIsRootA(lpszPath)) 500 if (!PathRemoveFileSpecA(lpszPath)) return FALSE; 501 return TRUE; 502 } 503 504 /************************************************************************* 505 * PathStripToRootW [SHLWAPI.@] 507 506 */ 508 507 BOOL WINAPI PathStripToRootW(LPWSTR lpszPath) 509 508 { 510 TRACE("%s\n", debugstr_w(lpszPath));511 512 if (!lpszPath) return FALSE;513 while(!PathIsRootW(lpszPath))514 if (!PathRemoveFileSpecW(lpszPath)) return FALSE;515 return TRUE;516 } 517 518 /************************************************************************* 519 * PathRemoveArgsA [SHLWAPI.@]509 TRACE("%s\n", debugstr_w(lpszPath)); 510 511 if (!lpszPath) return FALSE; 512 while(!PathIsRootW(lpszPath)) 513 if (!PathRemoveFileSpecW(lpszPath)) return FALSE; 514 return TRUE; 515 } 516 517 /************************************************************************* 518 * PathRemoveArgsA [SHLWAPI.@] 520 519 * 521 520 */ 522 521 void WINAPI PathRemoveArgsA(LPSTR lpszPath) 523 522 { 524 TRACE("%s\n",lpszPath);525 526 if(lpszPath)527 {528 LPSTR lpszArgs = PathGetArgsA(lpszPath);529 if (!*lpszArgs)530 {531 LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs);532 if(*lpszLastChar==' ') *lpszLastChar = '\0';533 }534 }535 } 536 537 /************************************************************************* 538 * PathRemoveArgsW [SHLWAPI.@]523 TRACE("%s\n",lpszPath); 524 525 if(lpszPath) 526 { 527 LPSTR lpszArgs = PathGetArgsA(lpszPath); 528 if (!*lpszArgs) 529 { 530 LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs); 531 if(*lpszLastChar==' ') *lpszLastChar = '\0'; 532 } 533 } 534 } 535 536 /************************************************************************* 537 * PathRemoveArgsW [SHLWAPI.@] 539 538 */ 540 539 void WINAPI PathRemoveArgsW(LPWSTR lpszPath) 541 540 { 542 TRACE("%s\n", debugstr_w(lpszPath));543 544 if(lpszPath)545 {546 LPWSTR lpszArgs = PathGetArgsW(lpszPath);547 if (!*lpszArgs)548 {549 LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs);550 if(*lpszLastChar==' ') *lpszLastChar = '\0';551 }552 }553 } 554 555 /************************************************************************* 556 * PathRemoveExtensionA [SHLWAPI.@]541 TRACE("%s\n", debugstr_w(lpszPath)); 542 543 if(lpszPath) 544 { 545 LPWSTR lpszArgs = PathGetArgsW(lpszPath); 546 if (!*lpszArgs) 547 { 548 LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs); 549 if(*lpszLastChar==' ') *lpszLastChar = '\0'; 550 } 551 } 552 } 553 554 /************************************************************************* 555 * PathRemoveExtensionA [SHLWAPI.@] 557 556 */ 558 557 void WINAPI PathRemoveExtensionA(LPSTR lpszPath) 559 558 { 560 LPSTR lpszExtension = PathFindExtensionA(lpszPath);561 562 TRACE("%s\n", lpszPath);563 564 if (lpszExtension) *lpszExtension='\0';565 } 566 567 /************************************************************************* 568 * PathRemoveExtensionW [SHLWAPI.@]559 LPSTR lpszExtension = PathFindExtensionA(lpszPath); 560 561 TRACE("%s\n", lpszPath); 562 563 if (lpszExtension) *lpszExtension='\0'; 564 } 565 566 /************************************************************************* 567 * PathRemoveExtensionW [SHLWAPI.@] 569 568 */ 570 569 void WINAPI PathRemoveExtensionW(LPWSTR lpszPath) 571 570 { 572 LPWSTR lpszExtension = PathFindExtensionW(lpszPath);573 574 TRACE("%s\n", debugstr_w(lpszPath));575 576 if (lpszExtension) *lpszExtension='\0';577 } 578 579 /************************************************************************* 580 * PathRemoveBackslashA [SHLWAPI.@]571 LPWSTR lpszExtension = PathFindExtensionW(lpszPath); 572 573 TRACE("%s\n", debugstr_w(lpszPath)); 574 575 if (lpszExtension) *lpszExtension='\0'; 576 } 577 578 /************************************************************************* 579 * PathRemoveBackslashA [SHLWAPI.@] 581 580 * 582 581 * If the path ends in a backslash it is replaced by a NULL 583 582 * and the address of the NULL is returned 584 * Otherwise 583 * Otherwise 585 584 * the address of the last character is returned. 586 585 * … … 590 589 LPSTR WINAPI PathRemoveBackslashA( LPSTR lpszPath ) 591 590 { 592 int len;593 LPSTR szTemp = NULL;594 595 if(lpszPath)596 {597 len = strlen(lpszPath);598 szTemp = CharPrevA(lpszPath, lpszPath+len);599 if (! PathIsRootA(lpszPath))600 {601 if (*szTemp == '\\') *szTemp = '\0';602 }603 }604 return szTemp;605 } 606 607 /************************************************************************* 608 * PathRemoveBackslashW [SHLWAPI.@]591 int len; 592 LPSTR szTemp = NULL; 593 594 if(lpszPath) 595 { 596 len = strlen(lpszPath); 597 szTemp = CharPrevA(lpszPath, lpszPath+len); 598 if (! PathIsRootA(lpszPath)) 599 { 600 if (*szTemp == '\\') *szTemp = '\0'; 601 } 602 } 603 return szTemp; 604 } 605 606 /************************************************************************* 607 * PathRemoveBackslashW [SHLWAPI.@] 609 608 */ 610 609 LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpszPath ) 611 610 { 612 int len;613 LPWSTR szTemp = NULL;614 615 if(lpszPath)616 {617 len = strlenW(lpszPath);618 szTemp = CharPrevW(lpszPath, lpszPath+len);619 if (! PathIsRootW(lpszPath))620 {621 if (*szTemp == '\\') *szTemp = '\0';622 }623 }624 return szTemp;611 int len; 612 LPWSTR szTemp = NULL; 613 614 if(lpszPath) 615 { 616 len = strlenW(lpszPath); 617 szTemp = CharPrevW(lpszPath, lpszPath+len); 618 if (! PathIsRootW(lpszPath)) 619 { 620 if (*szTemp == '\\') *szTemp = '\0'; 621 } 622 } 623 return szTemp; 625 624 } 626 625 627 626 628 627 /* 629 Path Manipulations628 Path Manipulations 630 629 */ 631 630 632 631 /************************************************************************* 633 632 * PathRemoveBlanksA [SHLWAPI.@] 634 * 633 * 635 634 * NOTES 636 635 * remove spaces from beginning and end of passed string … … 638 637 void WINAPI PathRemoveBlanksA(LPSTR str) 639 638 { 640 LPSTR x = str;641 642 TRACE("%s\n",str);643 644 if(str)645 {646 while (*x==' ') x = CharNextA(x);647 if (x!=str) strcpy(str,x);648 x=str+strlen(str)-1;649 while (*x==' ') x = CharPrevA(str, x);650 if (*x==' ') *x='\0';651 }639 LPSTR x = str; 640 641 TRACE("%s\n",str); 642 643 if(str) 644 { 645 while (*x==' ') x = CharNextA(x); 646 if (x!=str) strcpy(str,x); 647 x=str+strlen(str)-1; 648 while (*x==' ') x = CharPrevA(str, x); 649 if (*x==' ') *x='\0'; 650 } 652 651 } 653 652 … … 657 656 void WINAPI PathRemoveBlanksW(LPWSTR str) 658 657 { 659 LPWSTR x = str;660 661 TRACE("%s\n",debugstr_w(str));662 663 if(str)664 {665 while (*x==' ') x = CharNextW(x);666 if (x!=str) strcpyW(str,x);667 x=str+strlenW(str)-1;668 while (*x==' ') x = CharPrevW(str, x);669 if (*x==' ') *x='\0';670 }658 LPWSTR x = str; 659 660 TRACE("%s\n",debugstr_w(str)); 661 662 if(str) 663 { 664 while (*x==' ') x = CharNextW(x); 665 if (x!=str) strcpyW(str,x); 666 x=str+strlenW(str)-1; 667 while (*x==' ') x = CharPrevW(str, x); 668 if (*x==' ') *x='\0'; 669 } 671 670 } 672 671 673 672 /************************************************************************* 674 673 * PathQuoteSpacesA [SHLWAPI.@] 675 * 674 * 676 675 */ 677 676 LPSTR WINAPI PathQuoteSpacesA(LPSTR lpszPath) 678 677 { 679 TRACE("%s\n",lpszPath);680 681 if(StrChrA(lpszPath,' '))682 {683 int len = strlen(lpszPath);684 RtlMoveMemory(lpszPath+1, lpszPath, len);685 *(lpszPath++) = '"';686 lpszPath += len;687 *(lpszPath++) = '"';688 *(lpszPath) = '\0';689 return --lpszPath;690 }691 return 0;678 TRACE("%s\n",lpszPath); 679 680 if(StrChrA(lpszPath,' ')) 681 { 682 int len = strlen(lpszPath); 683 RtlMoveMemory(lpszPath+1, lpszPath, len); 684 *(lpszPath++) = '"'; 685 lpszPath += len; 686 *(lpszPath++) = '"'; 687 *(lpszPath) = '\0'; 688 return --lpszPath; 689 } 690 return 0; 692 691 } 693 692 … … 697 696 LPWSTR WINAPI PathQuoteSpacesW(LPWSTR lpszPath) 698 697 { 699 TRACE("%s\n",debugstr_w(lpszPath));700 701 if(StrChrW(lpszPath,' '))702 {703 int len = strlenW(lpszPath);704 RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR));705 *(lpszPath++) = '"';706 lpszPath += len;707 *(lpszPath++) = '"';708 *(lpszPath) = '\0';709 return --lpszPath;710 }711 return 0;698 TRACE("%s\n",debugstr_w(lpszPath)); 699 700 if(StrChrW(lpszPath,' ')) 701 { 702 int len = strlenW(lpszPath); 703 RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR)); 704 *(lpszPath++) = '"'; 705 lpszPath += len; 706 *(lpszPath++) = '"'; 707 *(lpszPath) = '\0'; 708 return --lpszPath; 709 } 710 return 0; 712 711 } 713 712 714 713 /************************************************************************* 715 714 * PathUnquoteSpacesA [SHLWAPI.@] 716 * 715 * 717 716 * NOTES 718 717 * unquote string (remove ") 719 718 */ 720 VOID WINAPI PathUnquoteSpacesA(LPSTR str) 721 { 722 DWORD len = strlen(str);723 724 TRACE("%s\n",str);725 726 if (*str!='"')727 return;728 if (str[len-1]!='"')729 return;730 str[len-1]='\0';731 strcpy(str,str+1);732 return;719 VOID WINAPI PathUnquoteSpacesA(LPSTR str) 720 { 721 DWORD len = strlen(str); 722 723 TRACE("%s\n",str); 724 725 if (*str!='"') 726 return; 727 if (str[len-1]!='"') 728 return; 729 str[len-1]='\0'; 730 strcpy(str,str+1); 731 return; 733 732 } 734 733 … … 736 735 * PathUnquoteSpacesW [SHLWAPI.@] 737 736 */ 738 VOID WINAPI PathUnquoteSpacesW(LPWSTR str) 739 { 740 DWORD len = strlenW(str);741 742 TRACE("%s\n",debugstr_w(str));743 744 if (*str!='"')745 return;746 if (str[len-1]!='"')747 return;748 str[len-1]='\0';749 strcpyW(str,str+1);750 return;751 } 752 753 /************************************************************************* 754 * PathParseIconLocationA [SHLWAPI.@]737 VOID WINAPI PathUnquoteSpacesW(LPWSTR str) 738 { 739 DWORD len = strlenW(str); 740 741 TRACE("%s\n",debugstr_w(str)); 742 743 if (*str!='"') 744 return; 745 if (str[len-1]!='"') 746 return; 747 str[len-1]='\0'; 748 strcpyW(str,str+1); 749 return; 750 } 751 752 /************************************************************************* 753 * PathParseIconLocationA [SHLWAPI.@] 755 754 */ 756 755 int WINAPI PathParseIconLocationA(LPSTR lpszPath) 757 756 { 758 LPSTR lpstrComma = strchr(lpszPath, ',');759 760 FIXME("%s stub\n", debugstr_a(lpszPath));761 762 if (lpstrComma && lpstrComma[1])763 {764 lpstrComma[0]='\0';765 /* return atoi(&lpstrComma[1]);FIXME */766 }767 768 PathUnquoteSpacesA(lpszPath);769 return 0;770 } 771 772 /************************************************************************* 773 * PathParseIconLocationW [SHLWAPI.@]757 LPSTR lpstrComma = strchr(lpszPath, ','); 758 759 FIXME("%s stub\n", debugstr_a(lpszPath)); 760 761 if (lpstrComma && lpstrComma[1]) 762 { 763 lpstrComma[0]='\0'; 764 /* return atoi(&lpstrComma[1]); FIXME */ 765 } 766 767 PathUnquoteSpacesA(lpszPath); 768 return 0; 769 } 770 771 /************************************************************************* 772 * PathParseIconLocationW [SHLWAPI.@] 774 773 */ 775 774 int WINAPI PathParseIconLocationW(LPWSTR lpszPath) 776 775 { 777 LPWSTR lpstrComma = strchrW(lpszPath, ',');778 779 FIXME("%s stub\n", debugstr_w(lpszPath));780 781 if (lpstrComma && lpstrComma[1])782 {783 lpstrComma[0]='\0';784 /* return _wtoi(&lpstrComma[1]);FIXME */785 }786 PathUnquoteSpacesW(lpszPath);787 return 0;776 LPWSTR lpstrComma = strchrW(lpszPath, ','); 777 778 FIXME("%s stub\n", debugstr_w(lpszPath)); 779 780 if (lpstrComma && lpstrComma[1]) 781 { 782 lpstrComma[0]='\0'; 783 /* return _wtoi(&lpstrComma[1]); FIXME */ 784 } 785 PathUnquoteSpacesW(lpszPath); 786 return 0; 788 787 } 789 788 790 789 /* 791 ########## cleaning and resolving paths ##########792 */ 793 794 /************************************************************************* 795 * PathFindOnPathA [SHLWAPI.@]790 ########## cleaning and resolving paths ########## 791 */ 792 793 /************************************************************************* 794 * PathFindOnPathA [SHLWAPI.@] 796 795 */ 797 796 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs) 798 797 { 799 FIXME("%s %s\n",sFile, sOtherDirs);800 return FALSE;801 } 802 803 /************************************************************************* 804 * PathFindOnPathW [SHLWAPI.@]798 FIXME("%s %s\n",sFile, sOtherDirs); 799 return FALSE; 800 } 801 802 /************************************************************************* 803 * PathFindOnPathW [SHLWAPI.@] 805 804 */ 806 805 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs) 807 806 { 808 FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));809 return FALSE;810 } 811 812 /************************************************************************* 813 * PathCompactPathExA [SHLWAPI.@]807 FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)); 808 return FALSE; 809 } 810 811 /************************************************************************* 812 * PathCompactPathExA [SHLWAPI.@] 814 813 */ 815 814 BOOL WINAPI PathCompactPathExA( 816 LPSTR pszOut,817 LPCSTR pszSrc,818 UINT cchMax,819 DWORD dwFlags)820 { 821 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags);822 return FALSE;823 } 824 825 /************************************************************************* 826 * PathCompactPathExW [SHLWAPI.@]815 LPSTR pszOut, 816 LPCSTR pszSrc, 817 UINT cchMax, 818 DWORD dwFlags) 819 { 820 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags); 821 return FALSE; 822 } 823 824 /************************************************************************* 825 * PathCompactPathExW [SHLWAPI.@] 827 826 */ 828 827 BOOL WINAPI PathCompactPathExW( 829 LPWSTR pszOut,830 LPCWSTR pszSrc,831 UINT cchMax,832 DWORD dwFlags)833 { 834 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags);835 return FALSE;828 LPWSTR pszOut, 829 LPCWSTR pszSrc, 830 UINT cchMax, 831 DWORD dwFlags) 832 { 833 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags); 834 return FALSE; 836 835 } 837 836 838 837 /* 839 ########## Path Testing ##########838 ########## Path Testing ########## 840 839 */ 841 840 842 841 /************************************************************************* 843 * PathIsUNCA [SHLWAPI.@]844 * 842 * PathIsUNCA [SHLWAPI.@] 843 * 845 844 * NOTES 846 845 * PathIsUNC(char*path); 847 846 */ 848 BOOL WINAPI PathIsUNCA(LPCSTR lpszPath) 849 { 850 TRACE("%s\n",lpszPath);851 852 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'));853 } 854 855 /************************************************************************* 856 * PathIsUNCW [SHLWAPI.@]857 */ 858 BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath) 859 { 860 TRACE("%s\n",debugstr_w(lpszPath));861 862 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'));863 } 864 865 /************************************************************************* 866 * PathIsRelativeA [SHLWAPI.@]847 BOOL WINAPI PathIsUNCA(LPCSTR lpszPath) 848 { 849 TRACE("%s\n",lpszPath); 850 851 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\')); 852 } 853 854 /************************************************************************* 855 * PathIsUNCW [SHLWAPI.@] 856 */ 857 BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath) 858 { 859 TRACE("%s\n",debugstr_w(lpszPath)); 860 861 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\')); 862 } 863 864 /************************************************************************* 865 * PathIsRelativeA [SHLWAPI.@] 867 866 */ 868 867 BOOL WINAPI PathIsRelativeA (LPCSTR lpszPath) 869 868 { 870 TRACE("lpszPath=%s\n",lpszPath);871 872 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':'));873 } 874 875 /************************************************************************* 876 * PathIsRelativeW [SHLWAPI.@]869 TRACE("lpszPath=%s\n",lpszPath); 870 871 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':')); 872 } 873 874 /************************************************************************* 875 * PathIsRelativeW [SHLWAPI.@] 877 876 */ 878 877 BOOL WINAPI PathIsRelativeW (LPCWSTR lpszPath) 879 878 { 880 TRACE("lpszPath=%s\n",debugstr_w(lpszPath));881 882 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':'));883 } 884 885 /************************************************************************* 886 * PathIsRootA [SHLWAPI.@]879 TRACE("lpszPath=%s\n",debugstr_w(lpszPath)); 880 881 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':')); 882 } 883 884 /************************************************************************* 885 * PathIsRootA [SHLWAPI.@] 887 886 * 888 887 * notes … … 891 890 BOOL WINAPI PathIsRootA(LPCSTR lpszPath) 892 891 { 893 TRACE("%s\n",lpszPath);894 895 /* X:\ */896 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0')897 return TRUE;898 899 /* "\" */900 if (lpszPath[0]=='\\' && lpszPath[1]=='\0')901 return TRUE;902 903 /* UNC "\\<computer>\<share>" */904 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 905 {906 int foundbackslash = 0;907 lpszPath += 2;908 while (*lpszPath)909 {910 if (*lpszPath=='\\') foundbackslash++;911 lpszPath = CharNextA(lpszPath);912 }913 if (foundbackslash <= 1)914 return TRUE;915 }916 return FALSE;917 } 918 919 /************************************************************************* 920 * PathIsRootW [SHLWAPI.@]921 */ 922 BOOL WINAPI PathIsRootW(LPCWSTR lpszPath) 923 { 924 TRACE("%s\n",debugstr_w(lpszPath));925 926 /* X:\ */927 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0')928 return TRUE;929 930 /* "\" */931 if (lpszPath[0]=='\\' && lpszPath[1]=='\0')932 return TRUE;933 934 /* UNC "\\<computer>\<share>" */935 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 936 {937 int foundbackslash = 0;938 lpszPath += 2;939 while (*lpszPath)940 {941 if (*lpszPath=='\\') foundbackslash++;942 lpszPath = CharNextW(lpszPath);943 }944 if (foundbackslash <= 1)945 return TRUE;946 }947 return FALSE;948 949 } 950 951 /************************************************************************* 952 * PathIsDirectoryA [SHLWAPI.@]892 TRACE("%s\n",lpszPath); 893 894 /* X:\ */ 895 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0') 896 return TRUE; 897 898 /* "\" */ 899 if (lpszPath[0]=='\\' && lpszPath[1]=='\0') 900 return TRUE; 901 902 /* UNC "\\<computer>\<share>" */ 903 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 904 { 905 int foundbackslash = 0; 906 lpszPath += 2; 907 while (*lpszPath) 908 { 909 if (*lpszPath=='\\') foundbackslash++; 910 lpszPath = CharNextA(lpszPath); 911 } 912 if (foundbackslash <= 1) 913 return TRUE; 914 } 915 return FALSE; 916 } 917 918 /************************************************************************* 919 * PathIsRootW [SHLWAPI.@] 920 */ 921 BOOL WINAPI PathIsRootW(LPCWSTR lpszPath) 922 { 923 TRACE("%s\n",debugstr_w(lpszPath)); 924 925 /* X:\ */ 926 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0') 927 return TRUE; 928 929 /* "\" */ 930 if (lpszPath[0]=='\\' && lpszPath[1]=='\0') 931 return TRUE; 932 933 /* UNC "\\<computer>\<share>" */ 934 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 935 { 936 int foundbackslash = 0; 937 lpszPath += 2; 938 while (*lpszPath) 939 { 940 if (*lpszPath=='\\') foundbackslash++; 941 lpszPath = CharNextW(lpszPath); 942 } 943 if (foundbackslash <= 1) 944 return TRUE; 945 } 946 return FALSE; 947 948 } 949 950 /************************************************************************* 951 * PathIsDirectoryA [SHLWAPI.@] 953 952 */ 954 953 BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath) 955 954 { 956 DWORD dwAttr;957 958 TRACE("%s\n", debugstr_a(lpszPath));959 960 dwAttr = GetFileAttributesA(lpszPath);961 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0;962 } 963 964 /************************************************************************* 965 * PathIsDirectoryW [SHLWAPI.@]955 DWORD dwAttr; 956 957 TRACE("%s\n", debugstr_a(lpszPath)); 958 959 dwAttr = GetFileAttributesA(lpszPath); 960 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; 961 } 962 963 /************************************************************************* 964 * PathIsDirectoryW [SHLWAPI.@] 966 965 */ 967 966 BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath) 968 967 { 969 DWORD dwAttr;970 971 TRACE("%s\n", debugstr_w(lpszPath));972 973 dwAttr = GetFileAttributesW(lpszPath);974 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0;975 } 976 977 /************************************************************************* 978 * PathFileExistsA [SHLWAPI.@]979 * 968 DWORD dwAttr; 969 970 TRACE("%s\n", debugstr_w(lpszPath)); 971 972 dwAttr = GetFileAttributesW(lpszPath); 973 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; 974 } 975 976 /************************************************************************* 977 * PathFileExistsA [SHLWAPI.@] 978 * 980 979 * NOTES 981 980 * file_exists(char *fn); 982 981 */ 983 BOOL WINAPI PathFileExistsA(LPCSTR lpszPath) 984 { 985 TRACE("%s\n",lpszPath);986 return (GetFileAttributesA(lpszPath)!=-1);987 } 988 989 /************************************************************************* 990 * PathFileExistsW [SHLWAPI.@]991 */ 992 BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath) 993 { 994 TRACE("%s\n",debugstr_w(lpszPath));995 return (GetFileAttributesW(lpszPath)!=-1);996 } 997 998 /************************************************************************* 999 * PathMatchSingleMaskA [internal]1000 * 982 BOOL WINAPI PathFileExistsA(LPCSTR lpszPath) 983 { 984 TRACE("%s\n",lpszPath); 985 return (GetFileAttributesA(lpszPath)!=-1); 986 } 987 988 /************************************************************************* 989 * PathFileExistsW [SHLWAPI.@] 990 */ 991 BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath) 992 { 993 TRACE("%s\n",debugstr_w(lpszPath)); 994 return (GetFileAttributesW(lpszPath)!=-1); 995 } 996 997 /************************************************************************* 998 * PathMatchSingleMaskA [internal] 999 * 1001 1000 * NOTES 1002 1001 * internal (used by PathMatchSpec) … … 1004 1003 static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask) 1005 1004 { 1006 while (*name && *mask && *mask!=';') 1007 {1008 if (*mask=='*') 1009 {1010 do 1011 {1012 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */1013 } while (*name++);1014 return 0;1015 }1016 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0;1017 name = CharNextA(name);1018 mask = CharNextA(mask);1019 }1020 if (!*name) 1021 {1022 while (*mask=='*') mask++;1023 if (!*mask || *mask==';') return 1;1024 }1025 return 0;1026 } 1027 1028 /************************************************************************* 1029 * PathMatchSingleMaskW [internal]1005 while (*name && *mask && *mask!=';') 1006 { 1007 if (*mask=='*') 1008 { 1009 do 1010 { 1011 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */ 1012 } while (*name++); 1013 return 0; 1014 } 1015 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0; 1016 name = CharNextA(name); 1017 mask = CharNextA(mask); 1018 } 1019 if (!*name) 1020 { 1021 while (*mask=='*') mask++; 1022 if (!*mask || *mask==';') return 1; 1023 } 1024 return 0; 1025 } 1026 1027 /************************************************************************* 1028 * PathMatchSingleMaskW [internal] 1030 1029 */ 1031 1030 static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask) 1032 1031 { 1033 while (*name && *mask && *mask!=';') 1034 {1035 if (*mask=='*') 1036 {1037 do 1038 {1039 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */1040 } while (*name++);1041 return 0;1042 }1043 if (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0;1044 name = CharNextW(name);1045 mask = CharNextW(mask);1046 }1047 if (!*name) 1048 {1049 while (*mask=='*') mask++;1050 if (!*mask || *mask==';') return 1;1051 }1052 return 0;1053 } 1054 /************************************************************************* 1055 * PathMatchSpecA [SHLWAPI.@]1056 * 1032 while (*name && *mask && *mask!=';') 1033 { 1034 if (*mask=='*') 1035 { 1036 do 1037 { 1038 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */ 1039 } while (*name++); 1040 return 0; 1041 } 1042 if (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0; 1043 name = CharNextW(name); 1044 mask = CharNextW(mask); 1045 } 1046 if (!*name) 1047 { 1048 while (*mask=='*') mask++; 1049 if (!*mask || *mask==';') return 1; 1050 } 1051 return 0; 1052 } 1053 /************************************************************************* 1054 * PathMatchSpecA [SHLWAPI.@] 1055 * 1057 1056 * NOTES 1058 1057 * used from COMDLG32 1059 1058 */ 1060 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask) 1061 { 1062 TRACE("%s %s\n",name,mask);1063 1064 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */1065 1066 while (*mask) 1067 {1068 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */1069 while (*mask && *mask!=';') mask = CharNextA(mask);1070 if (*mask==';') 1071 {1072 mask++;1073 while (*mask==' ') mask++; /* masks may be separated by "; " */1074 }1075 }1076 return 0;1077 } 1078 1079 /************************************************************************* 1080 * PathMatchSpecW [SHLWAPI.@]1081 */ 1082 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask) 1059 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask) 1060 { 1061 TRACE("%s %s\n",name,mask); 1062 1063 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */ 1064 1065 while (*mask) 1066 { 1067 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */ 1068 while (*mask && *mask!=';') mask = CharNextA(mask); 1069 if (*mask==';') 1070 { 1071 mask++; 1072 while (*mask==' ') mask++; /* masks may be separated by "; " */ 1073 } 1074 } 1075 return 0; 1076 } 1077 1078 /************************************************************************* 1079 * PathMatchSpecW [SHLWAPI.@] 1080 */ 1081 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask) 1083 1082 { 1084 1083 static const WCHAR stemp[] = { '*','.','*',0 }; 1085 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask));1086 1087 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */1088 1089 while (*mask) 1090 {1091 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */1092 while (*mask && *mask!=';') mask = CharNextW(mask);1093 if (*mask==';') 1094 {1095 mask++;1096 while (*mask==' ') mask++; /* masks may be separated by "; " */1097 }1098 }1099 return 0;1100 } 1101 1102 /************************************************************************* 1103 * PathIsSameRootA [SHLWAPI.@]1084 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask)); 1085 1086 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */ 1087 1088 while (*mask) 1089 { 1090 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */ 1091 while (*mask && *mask!=';') mask = CharNextW(mask); 1092 if (*mask==';') 1093 { 1094 mask++; 1095 while (*mask==' ') mask++; /* masks may be separated by "; " */ 1096 } 1097 } 1098 return 0; 1099 } 1100 1101 /************************************************************************* 1102 * PathIsSameRootA [SHLWAPI.@] 1104 1103 * 1105 1104 * FIXME … … 1108 1107 BOOL WINAPI PathIsSameRootA(LPCSTR lpszPath1, LPCSTR lpszPath2) 1109 1108 { 1110 TRACE("%s %s\n", lpszPath1, lpszPath2);1111 1112 if (PathIsRelativeA(lpszPath1) || PathIsRelativeA(lpszPath2)) return FALSE;1113 1114 /* usual path */1115 if ( toupper(lpszPath1[0])==toupper(lpszPath2[0]) &&1116 lpszPath1[1]==':' && lpszPath2[1]==':' &&1117 lpszPath1[2]=='\\' && lpszPath2[2]=='\\')1118 return TRUE;1119 1120 /* UNC */1121 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' &&1122 lpszPath1[1]=='\\' && lpszPath2[1]=='\\')1123 {1124 int pos=2, bsfound=0;1125 while (lpszPath1[pos] && lpszPath2[pos] &&1126 (lpszPath1[pos] == lpszPath2[pos]))1127 {1128 if (lpszPath1[pos]=='\\') bsfound++;1129 if (bsfound == 2) return TRUE;1130 pos++; /* fixme: use CharNext*/1131 }1132 return (lpszPath1[pos] == lpszPath2[pos]);1133 }1134 return FALSE;1135 } 1136 1137 /************************************************************************* 1138 * PathIsSameRootW [SHLWAPI.@]1109 TRACE("%s %s\n", lpszPath1, lpszPath2); 1110 1111 if (PathIsRelativeA(lpszPath1) || PathIsRelativeA(lpszPath2)) return FALSE; 1112 1113 /* usual path */ 1114 if ( toupper(lpszPath1[0])==toupper(lpszPath2[0]) && 1115 lpszPath1[1]==':' && lpszPath2[1]==':' && 1116 lpszPath1[2]=='\\' && lpszPath2[2]=='\\') 1117 return TRUE; 1118 1119 /* UNC */ 1120 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' && 1121 lpszPath1[1]=='\\' && lpszPath2[1]=='\\') 1122 { 1123 int pos=2, bsfound=0; 1124 while (lpszPath1[pos] && lpszPath2[pos] && 1125 (lpszPath1[pos] == lpszPath2[pos])) 1126 { 1127 if (lpszPath1[pos]=='\\') bsfound++; 1128 if (bsfound == 2) return TRUE; 1129 pos++; /* fixme: use CharNext*/ 1130 } 1131 return (lpszPath1[pos] == lpszPath2[pos]); 1132 } 1133 return FALSE; 1134 } 1135 1136 /************************************************************************* 1137 * PathIsSameRootW [SHLWAPI.@] 1139 1138 */ 1140 1139 BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2) 1141 1140 { 1142 TRACE("%s %s\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2));1143 1144 if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE;1145 1146 /* usual path */1147 if ( toupperW(lpszPath1[0])==toupperW(lpszPath2[0]) &&1148 lpszPath1[1]==':' && lpszPath2[1]==':' &&1149 lpszPath1[2]=='\\' && lpszPath2[2]=='\\')1150 return TRUE;1151 1152 /* UNC */1153 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' &&1154 lpszPath1[1]=='\\' && lpszPath2[1]=='\\')1155 {1156 int pos=2, bsfound=0;1157 while (lpszPath1[pos] && lpszPath2[pos] &&1158 (lpszPath1[pos] == lpszPath2[pos]))1159 {1160 if (lpszPath1[pos]=='\\') bsfound++;1161 if (bsfound == 2) return TRUE;1162 pos++;/* fixme: use CharNext*/1163 }1164 return (lpszPath1[pos] == lpszPath2[pos]);1165 }1166 return FALSE;1141 TRACE("%s %s\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2)); 1142 1143 if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE; 1144 1145 /* usual path */ 1146 if ( toupperW(lpszPath1[0])==toupperW(lpszPath2[0]) && 1147 lpszPath1[1]==':' && lpszPath2[1]==':' && 1148 lpszPath1[2]=='\\' && lpszPath2[2]=='\\') 1149 return TRUE; 1150 1151 /* UNC */ 1152 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' && 1153 lpszPath1[1]=='\\' && lpszPath2[1]=='\\') 1154 { 1155 int pos=2, bsfound=0; 1156 while (lpszPath1[pos] && lpszPath2[pos] && 1157 (lpszPath1[pos] == lpszPath2[pos])) 1158 { 1159 if (lpszPath1[pos]=='\\') bsfound++; 1160 if (bsfound == 2) return TRUE; 1161 pos++;/* fixme: use CharNext*/ 1162 } 1163 return (lpszPath1[pos] == lpszPath2[pos]); 1164 } 1165 return FALSE; 1167 1166 } 1168 1167 … … 1180 1179 // DWORD dwUnknown = SHREG_xxx; // 0x18 1181 1180 // return SHLWAPI_1(lpstrPath, &dwUnknown); 1182 1183 1184 LPSTR lpstrRes;1185 int iSize, i=0;1186 static LPSTR SupportedProtocol[] = 1187 {"http","https","ftp","gopher","file","mailto",NULL};1188 1189 if(!lpstrPath) return FALSE;1190 1191 /* get protocol */1192 lpstrRes = strchr(lpstrPath,':');1193 if(!lpstrRes) return FALSE;1194 iSize = lpstrRes - lpstrPath;1195 1196 while(SupportedProtocol[i])1197 {1198 if (iSize == strlen(SupportedProtocol[i]))1199 if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize))1200 return TRUE;1201 i++;1202 }1203 1204 return FALSE;1205 } 1181 1182 1183 LPSTR lpstrRes; 1184 int iSize, i=0; 1185 static LPSTR SupportedProtocol[] = 1186 {"http","https","ftp","gopher","file","mailto",NULL}; 1187 1188 if(!lpstrPath) return FALSE; 1189 1190 /* get protocol */ 1191 lpstrRes = strchr(lpstrPath,':'); 1192 if(!lpstrRes) return FALSE; 1193 iSize = lpstrRes - lpstrPath; 1194 1195 while(SupportedProtocol[i]) 1196 { 1197 if (iSize == strlen(SupportedProtocol[i])) 1198 if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize)) 1199 return TRUE; 1200 i++; 1201 } 1202 1203 return FALSE; 1204 } 1206 1205 1207 1206 /************************************************************************* … … 1210 1209 BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath) 1211 1210 { 1212 LPWSTR lpstrRes;1213 int iSize, i=0;1214 static WCHAR SupportedProtocol[7][7] = 1215 {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'},1216 {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'},1217 {'m','a','i','l','t','o','\0'},{0}};1218 1219 if(!lpstrPath) return FALSE;1220 1221 /* get protocol */1222 lpstrRes = strchrW(lpstrPath,':');1223 if(!lpstrRes) return FALSE;1224 iSize = lpstrRes - lpstrPath;1225 1226 while(SupportedProtocol[i])1227 {1228 if (iSize == strlenW(SupportedProtocol[i]))1229 if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize))1230 return TRUE;1231 i++;1232 }1233 1234 return FALSE;1235 } 1236 1237 1238 /************************************************************************* 1239 * PathIsContentTypeA [SHLWAPI.@]1211 LPWSTR lpstrRes; 1212 int iSize, i=0; 1213 static WCHAR SupportedProtocol[7][7] = 1214 {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'}, 1215 {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'}, 1216 {'m','a','i','l','t','o','\0'},{0}}; 1217 1218 if(!lpstrPath) return FALSE; 1219 1220 /* get protocol */ 1221 lpstrRes = strchrW(lpstrPath,':'); 1222 if(!lpstrRes) return FALSE; 1223 iSize = lpstrRes - lpstrPath; 1224 1225 while(SupportedProtocol[i]) 1226 { 1227 if (iSize == strlenW(SupportedProtocol[i])) 1228 if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize)) 1229 return TRUE; 1230 i++; 1231 } 1232 1233 return FALSE; 1234 } 1235 1236 1237 /************************************************************************* 1238 * PathIsContentTypeA [SHLWAPI.@] 1240 1239 */ 1241 1240 BOOL WINAPI PathIsContentTypeA(LPCSTR pszPath, LPCSTR pszContentType) 1242 1241 { 1243 FIXME("%s %s\n", pszPath, pszContentType);1244 return FALSE;1245 } 1246 1247 /************************************************************************* 1248 * PathIsContentTypeW [SHLWAPI.@]1242 FIXME("%s %s\n", pszPath, pszContentType); 1243 return FALSE; 1244 } 1245 1246 /************************************************************************* 1247 * PathIsContentTypeW [SHLWAPI.@] 1249 1248 */ 1250 1249 BOOL WINAPI PathIsContentTypeW(LPCWSTR pszPath, LPCWSTR pszContentType) 1251 1250 { 1252 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType));1253 return FALSE;1254 } 1255 1256 /************************************************************************* 1257 * PathIsFileSpecA [SHLWAPI.@]1251 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType)); 1252 return FALSE; 1253 } 1254 1255 /************************************************************************* 1256 * PathIsFileSpecA [SHLWAPI.@] 1258 1257 */ 1259 1258 BOOL WINAPI PathIsFileSpecA(LPCSTR pszPath) 1260 1259 { 1261 FIXME("%s\n", pszPath);1262 return FALSE;1263 } 1264 1265 /************************************************************************* 1266 * PathIsFileSpecW [SHLWAPI.@]1260 FIXME("%s\n", pszPath); 1261 return FALSE; 1262 } 1263 1264 /************************************************************************* 1265 * PathIsFileSpecW [SHLWAPI.@] 1267 1266 */ 1268 1267 BOOL WINAPI PathIsFileSpecW(LPCWSTR pszPath) 1269 1268 { 1270 FIXME("%s\n", debugstr_w(pszPath));1271 return FALSE;1272 } 1273 1274 /************************************************************************* 1275 * PathIsPrefixA [SHLWAPI.@]1269 FIXME("%s\n", debugstr_w(pszPath)); 1270 return FALSE; 1271 } 1272 1273 /************************************************************************* 1274 * PathIsPrefixA [SHLWAPI.@] 1276 1275 */ 1277 1276 BOOL WINAPI PathIsPrefixA(LPCSTR pszPrefix, LPCSTR pszPath) 1278 1277 { 1279 FIXME("%s %s\n", pszPrefix, pszPath);1280 return FALSE;1281 } 1282 1283 /************************************************************************* 1284 * PathIsPrefixW [SHLWAPI.@]1278 FIXME("%s %s\n", pszPrefix, pszPath); 1279 return FALSE; 1280 } 1281 1282 /************************************************************************* 1283 * PathIsPrefixW [SHLWAPI.@] 1285 1284 */ 1286 1285 BOOL WINAPI PathIsPrefixW(LPCWSTR pszPrefix, LPCWSTR pszPath) 1287 1286 { 1288 FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath));1289 return FALSE;1290 } 1291 1292 /************************************************************************* 1293 * PathIsSystemFolderA [SHLWAPI.@]1287 FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath)); 1288 return FALSE; 1289 } 1290 1291 /************************************************************************* 1292 * PathIsSystemFolderA [SHLWAPI.@] 1294 1293 */ 1295 1294 BOOL WINAPI PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb) 1296 1295 { 1297 FIXME("%s 0x%08lx\n", pszPath, dwAttrb);1298 return FALSE;1299 } 1300 1301 /************************************************************************* 1302 * PathIsSystemFolderW [SHLWAPI.@]1296 FIXME("%s 0x%08lx\n", pszPath, dwAttrb); 1297 return FALSE; 1298 } 1299 1300 /************************************************************************* 1301 * PathIsSystemFolderW [SHLWAPI.@] 1303 1302 */ 1304 1303 BOOL WINAPI PathIsSystemFolderW(LPCWSTR pszPath, DWORD dwAttrb) 1305 1304 { 1306 FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb);1307 return FALSE;1308 } 1309 1310 /************************************************************************* 1311 * PathIsUNCServerA [SHLWAPI.@]1305 FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb); 1306 return FALSE; 1307 } 1308 1309 /************************************************************************* 1310 * PathIsUNCServerA [SHLWAPI.@] 1312 1311 */ 1313 1312 BOOL WINAPI PathIsUNCServerA( 1314 LPCSTR pszPath)1315 { 1316 FIXME("%s\n", pszPath);1317 return FALSE;1318 } 1319 1320 /************************************************************************* 1321 * PathIsUNCServerW [SHLWAPI.@]1313 LPCSTR pszPath) 1314 { 1315 FIXME("%s\n", pszPath); 1316 return FALSE; 1317 } 1318 1319 /************************************************************************* 1320 * PathIsUNCServerW [SHLWAPI.@] 1322 1321 */ 1323 1322 BOOL WINAPI PathIsUNCServerW( 1324 LPCWSTR pszPath)1325 { 1326 FIXME("%s\n", debugstr_w(pszPath));1327 return FALSE;1328 } 1329 1330 /************************************************************************* 1331 * PathIsUNCServerShareA [SHLWAPI.@]1323 LPCWSTR pszPath) 1324 { 1325 FIXME("%s\n", debugstr_w(pszPath)); 1326 return FALSE; 1327 } 1328 1329 /************************************************************************* 1330 * PathIsUNCServerShareA [SHLWAPI.@] 1332 1331 */ 1333 1332 BOOL WINAPI PathIsUNCServerShareA( 1334 LPCSTR pszPath)1335 { 1336 FIXME("%s\n", pszPath);1337 return FALSE;1338 } 1339 1340 /************************************************************************* 1341 * PathIsUNCServerShareW [SHLWAPI.@]1333 LPCSTR pszPath) 1334 { 1335 FIXME("%s\n", pszPath); 1336 return FALSE; 1337 } 1338 1339 /************************************************************************* 1340 * PathIsUNCServerShareW [SHLWAPI.@] 1342 1341 */ 1343 1342 BOOL WINAPI PathIsUNCServerShareW( 1344 LPCWSTR pszPath)1345 { 1346 FIXME("%s\n", debugstr_w(pszPath));1347 return FALSE;1343 LPCWSTR pszPath) 1344 { 1345 FIXME("%s\n", debugstr_w(pszPath)); 1346 return FALSE; 1348 1347 } 1349 1348 … … 1354 1353 * returnvalue, use CharNext 1355 1354 */ 1356 1355 1357 1356 BOOL WINAPI PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath) 1358 1357 { 1359 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath);1360 BOOL bModifyed = FALSE;1361 1362 TRACE("%p %s\n", pszBuf, pszPath);1363 1364 pszBuf[OffsetDst]='\0';1365 1366 /* keep the root of the path */1367 if( LenSrc && (pszPath[OffsetSrc]=='\\'))1368 {1369 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1370 }1371 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':'))1372 {1373 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1374 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1375 if (LenSrc && (pszPath[OffsetSrc] == '\\'))1376 {1377 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1378 if (LenSrc == 1 && pszPath[OffsetSrc]=='.')1379 {1380 /* C:\. */1381 OffsetSrc++; LenSrc--; bModifyed = TRUE;1382 } 1383 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.')1384 {1385 /* C:\.. */1386 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1387 } 1358 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath); 1359 BOOL bModifyed = FALSE; 1360 1361 TRACE("%p %s\n", pszBuf, pszPath); 1362 1363 pszBuf[OffsetDst]='\0'; 1364 1365 /* keep the root of the path */ 1366 if( LenSrc && (pszPath[OffsetSrc]=='\\')) 1367 { 1368 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1369 } 1370 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':')) 1371 { 1372 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1373 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1374 if (LenSrc && (pszPath[OffsetSrc] == '\\')) 1375 { 1376 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1377 if (LenSrc == 1 && pszPath[OffsetSrc]=='.') 1378 { 1379 /* C:\. */ 1380 OffsetSrc++; LenSrc--; bModifyed = TRUE; 1381 } 1382 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.') 1383 { 1384 /* C:\.. */ 1385 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1386 } 1388 1387 } 1389 }1390 1391 /* ".\" at the beginning of the path */1392 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\')1393 {1394 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1395 } 1396 1397 while ( LenSrc )1398 {1399 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.'))1400 {1401 /* "\.." found, go one deeper */1402 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--;1403 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE;1404 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++;1405 pszBuf[OffsetDst] = '\0';/* important for \..\.. */1406 }1407 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' )1408 {1409 /* "\." found, skip it */1410 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE;1411 }1412 else1413 {1414 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--;1415 }1416 }1417 pszBuf[OffsetDst] = '\0';1418 TRACE("-- %s %u\n", pszBuf, bModifyed);1419 return bModifyed;1388 } 1389 1390 /* ".\" at the beginning of the path */ 1391 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\') 1392 { 1393 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1394 } 1395 1396 while ( LenSrc ) 1397 { 1398 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.')) 1399 { 1400 /* "\.." found, go one deeper */ 1401 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--; 1402 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE; 1403 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++; 1404 pszBuf[OffsetDst] = '\0'; /* important for \..\.. */ 1405 } 1406 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' ) 1407 { 1408 /* "\." found, skip it */ 1409 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE; 1410 } 1411 else 1412 { 1413 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--; 1414 } 1415 } 1416 pszBuf[OffsetDst] = '\0'; 1417 TRACE("-- %s %u\n", pszBuf, bModifyed); 1418 return bModifyed; 1420 1419 } 1421 1420 … … 1429 1428 BOOL WINAPI PathCanonicalizeW(LPWSTR pszBuf, LPCWSTR pszPath) 1430 1429 { 1431 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlenW(pszPath);1432 BOOL bModifyed = FALSE;1433 1434 TRACE("%p %s\n", pszBuf, debugstr_w(pszPath));1435 1436 pszBuf[OffsetDst]='\0';1437 1438 /* keep the root of the path */1439 if( LenSrc && (pszPath[OffsetSrc]=='\\'))1440 {1441 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1442 }1443 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':'))1444 {1445 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1446 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1447 if (LenSrc && (pszPath[OffsetSrc] == '\\'))1448 {1449 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1450 if (LenSrc == 1 && pszPath[OffsetSrc]=='.')1451 {1452 /* C:\. */1453 OffsetSrc++; LenSrc--; bModifyed = TRUE;1454 } 1455 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.')1456 {1457 /* C:\.. */1458 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1459 } 1430 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlenW(pszPath); 1431 BOOL bModifyed = FALSE; 1432 1433 TRACE("%p %s\n", pszBuf, debugstr_w(pszPath)); 1434 1435 pszBuf[OffsetDst]='\0'; 1436 1437 /* keep the root of the path */ 1438 if( LenSrc && (pszPath[OffsetSrc]=='\\')) 1439 { 1440 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1441 } 1442 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':')) 1443 { 1444 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1445 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1446 if (LenSrc && (pszPath[OffsetSrc] == '\\')) 1447 { 1448 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1449 if (LenSrc == 1 && pszPath[OffsetSrc]=='.') 1450 { 1451 /* C:\. */ 1452 OffsetSrc++; LenSrc--; bModifyed = TRUE; 1453 } 1454 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.') 1455 { 1456 /* C:\.. */ 1457 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1458 } 1460 1459 } 1461 }1462 1463 /* ".\" at the beginning of the path */1464 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\')1465 {1466 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1467 } 1468 1469 while ( LenSrc )1470 {1471 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.'))1472 {1473 /* "\.." found, go one deeper */1474 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--;1475 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE;1476 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++;1477 pszBuf[OffsetDst] = '\0';/* important for \..\.. */1478 }1479 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' )1480 {1481 /* "\." found, skip it */1482 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE;1483 }1484 else1485 {1486 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--;1487 }1488 }1489 pszBuf[OffsetDst] = '\0';1490 TRACE("-- %s %u\n", debugstr_w(pszBuf), bModifyed);1491 return bModifyed;1460 } 1461 1462 /* ".\" at the beginning of the path */ 1463 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\') 1464 { 1465 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1466 } 1467 1468 while ( LenSrc ) 1469 { 1470 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.')) 1471 { 1472 /* "\.." found, go one deeper */ 1473 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--; 1474 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE; 1475 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++; 1476 pszBuf[OffsetDst] = '\0'; /* important for \..\.. */ 1477 } 1478 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' ) 1479 { 1480 /* "\." found, skip it */ 1481 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE; 1482 } 1483 else 1484 { 1485 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--; 1486 } 1487 } 1488 pszBuf[OffsetDst] = '\0'; 1489 TRACE("-- %s %u\n", debugstr_w(pszBuf), bModifyed); 1490 return bModifyed; 1492 1491 } 1493 1492 … … 1497 1496 * NOTES 1498 1497 * special cases: 1499 * "" null1500 * aa "" (pointer to traling NULL)1501 * aa\ "" (pointer to traling NULL)1502 * aa\\ "" (pointer to traling NULL)1503 * aa\\bb bb1504 * aa\\\bb \bb1505 * c:\aa\ "aa\"1506 * \\aa aa1507 * \\aa\b aa\b1498 * "" null 1499 * aa "" (pointer to traling NULL) 1500 * aa\ "" (pointer to traling NULL) 1501 * aa\\ "" (pointer to traling NULL) 1502 * aa\\bb bb 1503 * aa\\\bb \bb 1504 * c:\aa\ "aa\" 1505 * \\aa aa 1506 * \\aa\b aa\b 1508 1507 */ 1509 1508 LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath) 1510 1509 { 1511 LPSTR pos;1512 1513 TRACE("%s\n", pszPath);1514 1515 if(!pszPath || !*pszPath) return NULL;1516 if(!(pos = StrChrA(pszPath, '\\')))1517 return (LPSTR) pszPath + strlen(pszPath);1518 pos++;1519 if(pos[0] == '\\') pos++;1520 return pos;1510 LPSTR pos; 1511 1512 TRACE("%s\n", pszPath); 1513 1514 if(!pszPath || !*pszPath) return NULL; 1515 if(!(pos = StrChrA(pszPath, '\\'))) 1516 return (LPSTR) pszPath + strlen(pszPath); 1517 pos++; 1518 if(pos[0] == '\\') pos++; 1519 return pos; 1521 1520 } 1522 1521 … … 1526 1525 LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath) 1527 1526 { 1528 LPWSTR pos;1529 1530 TRACE("%s\n", debugstr_w(pszPath));1531 1532 if(!pszPath || !*pszPath) return NULL;1533 if (!(pos = StrChrW(pszPath, '\\')))1534 return (LPWSTR) pszPath + strlenW(pszPath);1535 pos++;1536 if(pos[0] == '\\') pos++;1537 return pos;1527 LPWSTR pos; 1528 1529 TRACE("%s\n", debugstr_w(pszPath)); 1530 1531 if(!pszPath || !*pszPath) return NULL; 1532 if (!(pos = StrChrW(pszPath, '\\'))) 1533 return (LPWSTR) pszPath + strlenW(pszPath); 1534 pos++; 1535 if(pos[0] == '\\') pos++; 1536 return pos; 1538 1537 } 1539 1538 … … 1544 1543 * it adds never a dot 1545 1544 */ 1546 1545 1547 1546 BOOL WINAPI PathAddExtensionA( 1548 LPSTR pszPath,1549 LPCSTR pszExtension)1550 { 1551 if (*pszPath)1552 {1553 if (*(PathFindExtensionA(pszPath))) return FALSE;1554 1555 if (!pszExtension || *pszExtension=='\0')1556 strcat(pszPath, "exe");1557 else1558 strcat(pszPath, pszExtension);1559 }1560 1561 return TRUE;1562 } 1563 1564 /************************************************************************* 1565 * PathAddExtensionW [SHLWAPI.@]1547 LPSTR pszPath, 1548 LPCSTR pszExtension) 1549 { 1550 if (*pszPath) 1551 { 1552 if (*(PathFindExtensionA(pszPath))) return FALSE; 1553 1554 if (!pszExtension || *pszExtension=='\0') 1555 strcat(pszPath, "exe"); 1556 else 1557 strcat(pszPath, pszExtension); 1558 } 1559 1560 return TRUE; 1561 } 1562 1563 /************************************************************************* 1564 * PathAddExtensionW [SHLWAPI.@] 1566 1565 */ 1567 1566 BOOL WINAPI PathAddExtensionW( 1568 LPWSTR pszPath,1569 LPCWSTR pszExtension)1570 { 1571 static const WCHAR ext[] = { 'e','x','e',0 };1572 1573 if (*pszPath)1574 {1575 if (*(PathFindExtensionW(pszPath))) return FALSE;1576 1577 if (!pszExtension || *pszExtension=='\0')1578 strcatW(pszPath, ext);1579 else1580 strcatW(pszPath, pszExtension);1581 }1582 return TRUE;1583 1584 } 1585 1586 /************************************************************************* 1587 * PathMakePrettyA [SHLWAPI.@]1567 LPWSTR pszPath, 1568 LPCWSTR pszExtension) 1569 { 1570 static const WCHAR ext[] = { 'e','x','e',0 }; 1571 1572 if (*pszPath) 1573 { 1574 if (*(PathFindExtensionW(pszPath))) return FALSE; 1575 1576 if (!pszExtension || *pszExtension=='\0') 1577 strcatW(pszPath, ext); 1578 else 1579 strcatW(pszPath, pszExtension); 1580 } 1581 return TRUE; 1582 1583 } 1584 1585 /************************************************************************* 1586 * PathMakePrettyA [SHLWAPI.@] 1588 1587 */ 1589 1588 BOOL WINAPI PathMakePrettyA( 1590 LPSTR lpPath)1591 { 1592 FIXME("%s\n", lpPath);1593 return TRUE;1594 } 1595 1596 /************************************************************************* 1597 * PathMakePrettyW [SHLWAPI.@]1589 LPSTR lpPath) 1590 { 1591 FIXME("%s\n", lpPath); 1592 return TRUE; 1593 } 1594 1595 /************************************************************************* 1596 * PathMakePrettyW [SHLWAPI.@] 1598 1597 */ 1599 1598 BOOL WINAPI PathMakePrettyW( 1600 LPWSTR lpPath)1601 { 1602 FIXME("%s\n", debugstr_w(lpPath));1603 return TRUE;1604 1605 } 1606 1607 /************************************************************************* 1608 * PathCommonPrefixA [SHLWAPI.@]1599 LPWSTR lpPath) 1600 { 1601 FIXME("%s\n", debugstr_w(lpPath)); 1602 return TRUE; 1603 1604 } 1605 1606 /************************************************************************* 1607 * PathCommonPrefixA [SHLWAPI.@] 1609 1608 */ 1610 1609 int WINAPI PathCommonPrefixA( 1611 LPCSTR pszFile1,1612 LPCSTR pszFile2,1613 LPSTR achPath)1614 { 1615 FIXME("%s %s %p\n", pszFile1, pszFile2, achPath);1616 return 0;1617 } 1618 1619 /************************************************************************* 1620 * PathCommonPrefixW [SHLWAPI.@]1610 LPCSTR pszFile1, 1611 LPCSTR pszFile2, 1612 LPSTR achPath) 1613 { 1614 FIXME("%s %s %p\n", pszFile1, pszFile2, achPath); 1615 return 0; 1616 } 1617 1618 /************************************************************************* 1619 * PathCommonPrefixW [SHLWAPI.@] 1621 1620 */ 1622 1621 int WINAPI PathCommonPrefixW( 1623 LPCWSTR pszFile1,1624 LPCWSTR pszFile2,1625 LPWSTR achPath)1626 { 1627 FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath );1628 return 0;1629 } 1630 1631 /************************************************************************* 1632 * PathCompactPathA [SHLWAPI.@]1622 LPCWSTR pszFile1, 1623 LPCWSTR pszFile2, 1624 LPWSTR achPath) 1625 { 1626 FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath ); 1627 return 0; 1628 } 1629 1630 /************************************************************************* 1631 * PathCompactPathA [SHLWAPI.@] 1633 1632 */ 1634 1633 BOOL WINAPI PathCompactPathA(HDC hDC, LPSTR pszPath, UINT dx) 1635 1634 { 1636 FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx);1637 return FALSE;1638 } 1639 1640 /************************************************************************* 1641 * PathCompactPathW [SHLWAPI.@]1635 FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx); 1636 return FALSE; 1637 } 1638 1639 /************************************************************************* 1640 * PathCompactPathW [SHLWAPI.@] 1642 1641 */ 1643 1642 BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx) 1644 1643 { 1645 FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx);1646 return FALSE;1647 } 1648 1649 /************************************************************************* 1650 * PathGetCharTypeA [SHLWAPI.@]1644 FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx); 1645 return FALSE; 1646 } 1647 1648 /************************************************************************* 1649 * PathGetCharTypeA [SHLWAPI.@] 1651 1650 */ 1652 1651 UINT WINAPI PathGetCharTypeA(UCHAR ch) … … 1654 1653 UINT flags = 0; 1655 1654 1656 TRACE("%c\n", ch);1657 1658 /* We could use them in filenames, but this would confuse 'ls' */1659 if (iscntrl(ch))1660 return GCT_INVALID;1661 if ((ch == '*') || (ch=='?'))1662 return GCT_WILD;1663 if ((ch == '\\') || (ch=='/'))1664 return GCT_SEPARATOR;1665 flags = 0;1666 /* all normal characters, no lower case letters */1667 if ((ch > ' ') && (ch < 0x7f) && !islower(ch))1668 flags |= GCT_SHORTCHAR;1669 /* All other characters are valid in long filenames, even umlauts */1670 return flags | GCT_LFNCHAR;1671 } 1672 1673 /************************************************************************* 1674 * PathGetCharTypeW [SHLWAPI.@]1655 TRACE("%c\n", ch); 1656 1657 /* We could use them in filenames, but this would confuse 'ls' */ 1658 if (iscntrl(ch)) 1659 return GCT_INVALID; 1660 if ((ch == '*') || (ch=='?')) 1661 return GCT_WILD; 1662 if ((ch == '\\') || (ch=='/')) 1663 return GCT_SEPARATOR; 1664 flags = 0; 1665 /* all normal characters, no lower case letters */ 1666 if ((ch > ' ') && (ch < 0x7f) && !islower(ch)) 1667 flags |= GCT_SHORTCHAR; 1668 /* All other characters are valid in long filenames, even umlauts */ 1669 return flags | GCT_LFNCHAR; 1670 } 1671 1672 /************************************************************************* 1673 * PathGetCharTypeW [SHLWAPI.@] 1675 1674 */ 1676 1675 UINT WINAPI PathGetCharTypeW(WCHAR ch) 1677 1676 { 1678 FIXME("%c, using ascii version\n", ch);1679 return PathGetCharTypeA(ch);1680 } 1681 1682 /************************************************************************* 1683 * PathMakeSystemFolderA [SHLWAPI.@]1677 FIXME("%c, using ascii version\n", ch); 1678 return PathGetCharTypeA(ch); 1679 } 1680 1681 /************************************************************************* 1682 * PathMakeSystemFolderA [SHLWAPI.@] 1684 1683 */ 1685 1684 BOOL WINAPI PathMakeSystemFolderA(LPCSTR pszPath) 1686 1685 { 1687 FIXME("%s\n", pszPath);1688 return FALSE;1689 } 1690 1691 /************************************************************************* 1692 * PathMakeSystemFolderW [SHLWAPI.@]1686 FIXME("%s\n", pszPath); 1687 return FALSE; 1688 } 1689 1690 /************************************************************************* 1691 * PathMakeSystemFolderW [SHLWAPI.@] 1693 1692 */ 1694 1693 BOOL WINAPI PathMakeSystemFolderW(LPCWSTR pszPath) 1695 1694 { 1696 FIXME("%s\n", debugstr_w(pszPath));1697 return FALSE;1698 } 1699 1700 /************************************************************************* 1701 * PathRenameExtensionA [SHLWAPI.@]1695 FIXME("%s\n", debugstr_w(pszPath)); 1696 return FALSE; 1697 } 1698 1699 /************************************************************************* 1700 * PathRenameExtensionA [SHLWAPI.@] 1702 1701 */ 1703 1702 BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) 1704 1703 { 1705 FIXME("%s %s\n", pszPath, pszExt);1706 return FALSE;1707 } 1708 1709 /************************************************************************* 1710 * PathRenameExtensionW [SHLWAPI.@]1704 FIXME("%s %s\n", pszPath, pszExt); 1705 return FALSE; 1706 } 1707 1708 /************************************************************************* 1709 * PathRenameExtensionW [SHLWAPI.@] 1711 1710 */ 1712 1711 BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt) 1713 1712 { 1714 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt));1715 return FALSE;1716 } 1717 1718 /************************************************************************* 1719 * PathSearchAndQualifyA [SHLWAPI.@]1713 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt)); 1714 return FALSE; 1715 } 1716 1717 /************************************************************************* 1718 * PathSearchAndQualifyA [SHLWAPI.@] 1720 1719 */ 1721 1720 BOOL WINAPI PathSearchAndQualifyA( 1722 LPCSTR pszPath,1723 LPSTR pszBuf,1724 UINT cchBuf)1725 { 1726 FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf);1727 return FALSE;1728 } 1729 1730 /************************************************************************* 1731 * PathSearchAndQualifyW [SHLWAPI.@]1721 LPCSTR pszPath, 1722 LPSTR pszBuf, 1723 UINT cchBuf) 1724 { 1725 FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf); 1726 return FALSE; 1727 } 1728 1729 /************************************************************************* 1730 * PathSearchAndQualifyW [SHLWAPI.@] 1732 1731 */ 1733 1732 BOOL WINAPI PathSearchAndQualifyW( 1734 LPCWSTR pszPath,1735 LPWSTR pszBuf,1736 UINT cchBuf)1737 { 1738 FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf);1739 return FALSE;1733 LPCWSTR pszPath, 1734 LPWSTR pszBuf, 1735 UINT cchBuf) 1736 { 1737 FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf); 1738 return FALSE; 1740 1739 } 1741 1740 1742 1741 #ifndef __WIN32OS2__ 1743 1742 /************************************************************************* 1744 * PathSkipRootA [SHLWAPI.@]1743 * PathSkipRootA [SHLWAPI.@] 1745 1744 */ 1746 1745 LPSTR WINAPI PathSkipRootA(LPCSTR pszPath) 1747 1746 { 1748 FIXME("%s\n", pszPath);1749 return (LPSTR)pszPath;1750 } 1751 1752 /************************************************************************* 1753 * PathSkipRootW [SHLWAPI.@]1747 FIXME("%s\n", pszPath); 1748 return (LPSTR)pszPath; 1749 } 1750 1751 /************************************************************************* 1752 * PathSkipRootW [SHLWAPI.@] 1754 1753 */ 1755 1754 LPWSTR WINAPI PathSkipRootW(LPCWSTR pszPath) 1756 1755 { 1757 FIXME("%s\n", debugstr_w(pszPath));1758 return (LPWSTR)pszPath;1756 FIXME("%s\n", debugstr_w(pszPath)); 1757 return (LPWSTR)pszPath; 1759 1758 } 1760 1759 #endif 1761 1760 1762 1761 /************************************************************************* 1763 * PathCreateFromUrlA [SHLWAPI.@]1762 * PathCreateFromUrlA [SHLWAPI.@] 1764 1763 */ 1765 1764 HRESULT WINAPI PathCreateFromUrlA( 1766 LPCSTR pszUrl,1767 LPSTR pszPath,1768 LPDWORD pcchPath,1769 DWORD dwFlags)1770 { 1771 FIXME("%s %p %p 0x%08lx\n",1772 pszUrl, pszPath, pcchPath, dwFlags);1773 return S_OK;1774 } 1775 1776 /************************************************************************* 1777 * PathCreateFromUrlW [SHLWAPI.@]1765 LPCSTR pszUrl, 1766 LPSTR pszPath, 1767 LPDWORD pcchPath, 1768 DWORD dwFlags) 1769 { 1770 FIXME("%s %p %p 0x%08lx\n", 1771 pszUrl, pszPath, pcchPath, dwFlags); 1772 return S_OK; 1773 } 1774 1775 /************************************************************************* 1776 * PathCreateFromUrlW [SHLWAPI.@] 1778 1777 */ 1779 1778 HRESULT WINAPI PathCreateFromUrlW( 1780 LPCWSTR pszUrl,1781 LPWSTR pszPath,1782 LPDWORD pcchPath,1783 DWORD dwFlags)1784 { 1785 FIXME("%s %p %p 0x%08lx\n",1786 debugstr_w(pszUrl), pszPath, pcchPath, dwFlags);1787 return S_OK;1788 } 1789 1790 /************************************************************************* 1791 * PathRelativePathToA [SHLWAPI.@]1779 LPCWSTR pszUrl, 1780 LPWSTR pszPath, 1781 LPDWORD pcchPath, 1782 DWORD dwFlags) 1783 { 1784 FIXME("%s %p %p 0x%08lx\n", 1785 debugstr_w(pszUrl), pszPath, pcchPath, dwFlags); 1786 return S_OK; 1787 } 1788 1789 /************************************************************************* 1790 * PathRelativePathToA [SHLWAPI.@] 1792 1791 */ 1793 1792 BOOL WINAPI PathRelativePathToA( 1794 LPSTR pszPath,1795 LPCSTR pszFrom,1796 DWORD dwAttrFrom,1797 LPCSTR pszTo,1798 DWORD dwAttrTo)1799 { 1800 FIXME("%s %s 0x%08lx %s 0x%08lx\n",1801 pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo);1802 return FALSE;1803 } 1804 1805 /************************************************************************* 1806 * PathRelativePathToW [SHLWAPI.@]1793 LPSTR pszPath, 1794 LPCSTR pszFrom, 1795 DWORD dwAttrFrom, 1796 LPCSTR pszTo, 1797 DWORD dwAttrTo) 1798 { 1799 FIXME("%s %s 0x%08lx %s 0x%08lx\n", 1800 pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo); 1801 return FALSE; 1802 } 1803 1804 /************************************************************************* 1805 * PathRelativePathToW [SHLWAPI.@] 1807 1806 */ 1808 1807 BOOL WINAPI PathRelativePathToW( 1809 LPWSTR pszPath,1810 LPCWSTR pszFrom,1811 DWORD dwAttrFrom,1812 LPCWSTR pszTo,1813 DWORD dwAttrTo)1814 { 1815 FIXME("%s %s 0x%08lx %s 0x%08lx\n",1816 debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo);1817 return FALSE;1818 } 1819 1820 /************************************************************************* 1821 * PathUnmakeSystemFolderA [SHLWAPI.@]1808 LPWSTR pszPath, 1809 LPCWSTR pszFrom, 1810 DWORD dwAttrFrom, 1811 LPCWSTR pszTo, 1812 DWORD dwAttrTo) 1813 { 1814 FIXME("%s %s 0x%08lx %s 0x%08lx\n", 1815 debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo); 1816 return FALSE; 1817 } 1818 1819 /************************************************************************* 1820 * PathUnmakeSystemFolderA [SHLWAPI.@] 1822 1821 */ 1823 1822 BOOL WINAPI PathUnmakeSystemFolderA(LPCSTR pszPath) 1824 1823 { 1825 FIXME("%s\n", pszPath);1826 return FALSE;1827 } 1828 1829 /************************************************************************* 1830 * PathUnmakeSystemFolderW [SHLWAPI.@]1824 FIXME("%s\n", pszPath); 1825 return FALSE; 1826 } 1827 1828 /************************************************************************* 1829 * PathUnmakeSystemFolderW [SHLWAPI.@] 1831 1830 */ 1832 1831 BOOL WINAPI PathUnmakeSystemFolderW(LPCWSTR pszPath) 1833 1832 { 1834 FIXME("%s\n", debugstr_w(pszPath));1835 return FALSE;1833 FIXME("%s\n", debugstr_w(pszPath)); 1834 return FALSE; 1836 1835 } 1837 1836 1838 1837 /* 1839 ########## special ##########1838 ########## special ########## 1840 1839 */ 1841 1840 … … 1846 1845 * use PathCompactPath to make sure, the path fits into the control 1847 1846 */ 1848 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath) 1849 { TRACE("%x %x %s\n",hDlg, id, pszPath);1850 return SetDlgItemTextA(hDlg, id, pszPath);1847 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath) 1848 { TRACE("%x %x %s\n",hDlg, id, pszPath); 1849 return SetDlgItemTextA(hDlg, id, pszPath); 1851 1850 } 1852 1851 … … 1854 1853 * PathSetDlgItemPathW [SHLWAPI.@] 1855 1854 */ 1856 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) 1857 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath));1858 return SetDlgItemTextW(hDlg, id, pszPath);1859 } 1855 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) 1856 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath)); 1857 return SetDlgItemTextW(hDlg, id, pszPath); 1858 } -
trunk/src/shlwapi/reg.c
r6650 r6712 1 /* $Id: reg.c,v 1.5 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 2 * SHLWAPI registry functions … … 33 32 34 33 /************************************************************************* 35 * SHRegGetUSValueA [SHLWAPI.@]34 * SHRegGetUSValueA [SHLWAPI.@] 36 35 * 37 36 * Gets a user-specific registry value 38 37 */ 39 38 LONG WINAPI SHRegGetUSValueA( 40 LPCSTR pSubKey,41 LPCSTR pValue,42 LPDWORD pwType,43 LPVOID pvData,44 LPDWORD pbData,45 BOOL fIgnoreHKCU,46 LPVOID pDefaultData,47 DWORD wDefaultDataSize)48 { 49 FIXME("(%p),stub!\n", pSubKey);50 return ERROR_SUCCESS; /* return success */51 } 52 53 /************************************************************************* 54 * SHRegGetUSValueW [SHLWAPI.@]39 LPCSTR pSubKey, 40 LPCSTR pValue, 41 LPDWORD pwType, 42 LPVOID pvData, 43 LPDWORD pbData, 44 BOOL fIgnoreHKCU, 45 LPVOID pDefaultData, 46 DWORD wDefaultDataSize) 47 { 48 FIXME("(%p),stub!\n", pSubKey); 49 return ERROR_SUCCESS; /* return success */ 50 } 51 52 /************************************************************************* 53 * SHRegGetUSValueW [SHLWAPI.@] 55 54 * 56 55 * Gets a user-specific registry value 57 56 */ 58 57 LONG WINAPI SHRegGetUSValueW( 59 LPCWSTR pSubKey,60 LPCWSTR pValue,61 LPDWORD pwType,62 LPVOID pvData,63 LPDWORD pbData,64 BOOL flagIgnoreHKCU,65 LPVOID pDefaultData,66 DWORD wDefaultDataSize)67 { 68 FIXME("(%p),stub!\n", pSubKey);69 return ERROR_SUCCESS; /* return success */70 } 71 72 /************************************************************************* 73 * SHRegOpenUSKeyA [SHLWAPI.@]58 LPCWSTR pSubKey, 59 LPCWSTR pValue, 60 LPDWORD pwType, 61 LPVOID pvData, 62 LPDWORD pbData, 63 BOOL flagIgnoreHKCU, 64 LPVOID pDefaultData, 65 DWORD wDefaultDataSize) 66 { 67 FIXME("(%p),stub!\n", pSubKey); 68 return ERROR_SUCCESS; /* return success */ 69 } 70 71 /************************************************************************* 72 * SHRegOpenUSKeyA [SHLWAPI.@] 74 73 * 75 74 * Openss a user-specific registry key … … 82 81 BOOL fIgnoreHKCU) 83 82 { 84 FIXME("stub!\n");85 return ERROR_SUCCESS; /* return success */86 } 87 88 /************************************************************************* 89 * SHRegOpenUSKeyW [SHLWAPI.@]83 FIXME("stub!\n"); 84 return ERROR_SUCCESS; /* return success */ 85 } 86 87 /************************************************************************* 88 * SHRegOpenUSKeyW [SHLWAPI.@] 90 89 * 91 90 * Openss a user-specific registry key … … 98 97 BOOL fIgnoreHKCU) 99 98 { 100 FIXME("stub!\n");101 return ERROR_SUCCESS; /* return success */99 FIXME("stub!\n"); 100 return ERROR_SUCCESS; /* return success */ 102 101 } 103 102 … … 107 106 */ 108 107 BOOL WINAPI SHRegGetBoolUSValueA( 109 LPCSTR pszSubKey,110 LPCSTR pszValue,111 BOOL fIgnoreHKCU,112 BOOL fDefault)113 { 114 FIXME("%s %s\n", pszSubKey,pszValue);115 return fDefault;116 } 117 118 /************************************************************************* 119 * SHRegGetBoolUSValueW [SHLWAPI.@]108 LPCSTR pszSubKey, 109 LPCSTR pszValue, 110 BOOL fIgnoreHKCU, 111 BOOL fDefault) 112 { 113 FIXME("%s %s\n", pszSubKey,pszValue); 114 return fDefault; 115 } 116 117 /************************************************************************* 118 * SHRegGetBoolUSValueW [SHLWAPI.@] 120 119 */ 121 120 BOOL WINAPI SHRegGetBoolUSValueW( 122 LPCWSTR pszSubKey,123 LPCWSTR pszValue,124 BOOL fIgnoreHKCU,125 BOOL fDefault)126 { 127 FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue));128 return fDefault;121 LPCWSTR pszSubKey, 122 LPCWSTR pszValue, 123 BOOL fIgnoreHKCU, 124 BOOL fDefault) 125 { 126 FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue)); 127 return fDefault; 129 128 } 130 129 #endif 131 130 132 131 /************************************************************************* 133 * SHRegQueryUSValueA [SHLWAPI]132 * SHRegQueryUSValueA [SHLWAPI] 134 133 */ 135 134 LONG WINAPI SHRegQueryUSValueA( 136 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */137 LPCSTR pszValue,138 LPDWORD pdwType,139 LPVOID pvData,140 LPDWORD pcbData,141 BOOL fIgnoreHKCU,142 LPVOID pvDefaultData,143 DWORD dwDefaultDataSize)144 { 145 FIXME("%s stub\n",pszValue);146 return 1;147 } 148 149 /************************************************************************* 150 * SHRegQueryUSValueA [SHLWAPI]135 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */ 136 LPCSTR pszValue, 137 LPDWORD pdwType, 138 LPVOID pvData, 139 LPDWORD pcbData, 140 BOOL fIgnoreHKCU, 141 LPVOID pvDefaultData, 142 DWORD dwDefaultDataSize) 143 { 144 FIXME("%s stub\n",pszValue); 145 return 1; 146 } 147 148 /************************************************************************* 149 * SHRegQueryUSValueA [SHLWAPI] 151 150 */ 152 151 LONG WINAPI SHRegQueryUSValueW( 153 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */154 LPCSTR pszValue,155 LPDWORD pdwType,156 void *pvData,157 LPDWORD pcbData,158 BOOL fIgnoreHKCU,159 void *pvDefaultData,160 DWORD dwDefaultDataSize)161 { 162 FIXME("%s stub\n",pszValue);163 return 1;152 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */ 153 LPCSTR pszValue, 154 LPDWORD pdwType, 155 void *pvData, 156 LPDWORD pcbData, 157 BOOL fIgnoreHKCU, 158 void *pvDefaultData, 159 DWORD dwDefaultDataSize) 160 { 161 FIXME("%s stub\n",pszValue); 162 return 1; 164 163 } 165 164 … … 168 167 */ 169 168 DWORD WINAPI SHRegGetPathA( 170 HKEY hKey,171 LPCSTR pcszSubKey,172 LPCSTR pcszValue,173 LPSTR pszPath,174 DWORD dwFlags)175 { 176 FIXME("%s %s\n", pcszSubKey, pcszValue);177 return 0;169 HKEY hKey, 170 LPCSTR pcszSubKey, 171 LPCSTR pcszValue, 172 LPSTR pszPath, 173 DWORD dwFlags) 174 { 175 FIXME("%s %s\n", pcszSubKey, pcszValue); 176 return 0; 178 177 } 179 178 … … 182 181 */ 183 182 DWORD WINAPI SHRegGetPathW( 184 HKEY hKey,185 LPCWSTR pcszSubKey,186 LPCWSTR pcszValue,187 LPWSTR pszPath,188 DWORD dwFlags)189 { 190 FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue));191 return 0;183 HKEY hKey, 184 LPCWSTR pcszSubKey, 185 LPCWSTR pcszValue, 186 LPWSTR pszPath, 187 DWORD dwFlags) 188 { 189 FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue)); 190 return 0; 192 191 } 193 192 … … 198 197 */ 199 198 DWORD WINAPI SHGetValueA( 200 HKEY hkey,201 LPCSTR pSubKey,202 LPCSTR pValue,203 LPDWORD pwType,204 LPVOID pvData,205 LPDWORD pbData)206 { 207 HKEY hSubKey;208 DWORD res;209 210 TRACE("(%s %s)\n", pSubKey, pValue);211 212 if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res;213 res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData);214 RegCloseKey( hSubKey );215 216 return res;199 HKEY hkey, 200 LPCSTR pSubKey, 201 LPCSTR pValue, 202 LPDWORD pwType, 203 LPVOID pvData, 204 LPDWORD pbData) 205 { 206 HKEY hSubKey; 207 DWORD res; 208 209 TRACE("(%s %s)\n", pSubKey, pValue); 210 211 if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res; 212 res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData); 213 RegCloseKey( hSubKey ); 214 215 return res; 217 216 } 218 217 … … 223 222 */ 224 223 DWORD WINAPI SHGetValueW( 225 HKEY hkey,226 LPCWSTR pSubKey,227 LPCWSTR pValue,228 LPDWORD pwType,229 LPVOID pvData,230 LPDWORD pbData)231 { 232 HKEY hSubKey;233 DWORD res;234 235 TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue));236 237 if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res;238 res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData);239 RegCloseKey( hSubKey );240 241 return res;224 HKEY hkey, 225 LPCWSTR pSubKey, 226 LPCWSTR pValue, 227 LPDWORD pwType, 228 LPVOID pvData, 229 LPDWORD pbData) 230 { 231 HKEY hSubKey; 232 DWORD res; 233 234 TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue)); 235 236 if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res; 237 res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData); 238 RegCloseKey( hSubKey ); 239 240 return res; 242 241 } 243 242 … … 246 245 */ 247 246 HRESULT WINAPI SHSetValueA( 248 HKEY hkey,249 LPCSTR pszSubKey,250 LPCSTR pszValue,251 DWORD dwType,252 LPCVOID pvData,253 DWORD cbData)254 { 255 HKEY subkey;256 HRESULT hres;247 HKEY hkey, 248 LPCSTR pszSubKey, 249 LPCSTR pszValue, 250 DWORD dwType, 251 LPCVOID pvData, 252 DWORD cbData) 253 { 254 HKEY subkey; 255 HRESULT hres; 257 256 258 257 hres = RegCreateKeyA(hkey,pszSubKey,&subkey); 259 258 if (!hres) 260 return hres;259 return hres; 261 260 hres = RegSetValueExA(subkey,pszValue,0,dwType,pvData,cbData); 262 261 RegCloseKey(subkey); … … 268 267 */ 269 268 HRESULT WINAPI SHSetValueW( 270 HKEY hkey,271 LPCWSTR pszSubKey,272 LPCWSTR pszValue,273 DWORD dwType,274 LPCVOID pvData,275 DWORD cbData)276 { 277 HKEY subkey;278 HRESULT hres;269 HKEY hkey, 270 LPCWSTR pszSubKey, 271 LPCWSTR pszValue, 272 DWORD dwType, 273 LPCVOID pvData, 274 DWORD cbData) 275 { 276 HKEY subkey; 277 HRESULT hres; 279 278 280 279 hres = RegCreateKeyW(hkey,pszSubKey,&subkey); 281 280 if (!hres) 282 return hres;281 return hres; 283 282 hres = RegSetValueExW(subkey,pszValue,0,dwType,pvData,cbData); 284 283 RegCloseKey(subkey); … … 287 286 288 287 /************************************************************************* 289 * SHQueryValueExA [SHLWAPI.@]288 * SHQueryValueExA [SHLWAPI.@] 290 289 * 291 290 */ 292 291 HRESULT WINAPI SHQueryValueExA( 293 HKEY hkey,294 LPSTR lpValueName,295 LPDWORD lpReserved,296 LPDWORD lpType,297 LPBYTE lpData,298 LPDWORD lpcbData)299 { 300 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);301 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);292 HKEY hkey, 293 LPSTR lpValueName, 294 LPDWORD lpReserved, 295 LPDWORD lpType, 296 LPBYTE lpData, 297 LPDWORD lpcbData) 298 { 299 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 300 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 302 301 } 303 302 … … 306 305 * SHQueryValueExW [SHLWAPI.@] 307 306 * 308 * FIXME 307 * FIXME 309 308 * if the datatype REG_EXPAND_SZ then expand the string and change 310 309 * *pdwType to REG_SZ. 311 310 */ 312 311 HRESULT WINAPI SHQueryValueExW ( 313 HKEY hkey,314 LPWSTR pszValue,315 LPDWORD pdwReserved,316 LPDWORD pdwType,317 LPVOID pvData,318 LPDWORD pcbData)319 { 320 WARN("0x%04x %s %p %p %p %p semi-stub\n",312 HKEY hkey, 313 LPWSTR pszValue, 314 LPDWORD pdwReserved, 315 LPDWORD pdwType, 316 LPVOID pvData, 317 LPDWORD pcbData) 318 { 319 WARN("0x%04x %s %p %p %p %p semi-stub\n", 321 320 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); 322 return RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);321 return RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData); 323 322 } 324 323 … … 333 332 */ 334 333 HRESULT WINAPI SHDeleteKeyA( 335 HKEY hKey,336 LPCSTR lpszSubKey)334 HKEY hKey, 335 LPCSTR lpszSubKey) 337 336 { 338 337 DWORD r, dwKeyCount, dwSize, i, dwMaxSubkeyLen; … … 399 398 */ 400 399 HRESULT WINAPI SHDeleteKeyW( 401 HKEY hkey,402 LPCWSTR pszSubKey)403 { 404 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));405 return 0;400 HKEY hkey, 401 LPCWSTR pszSubKey) 402 { 403 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey)); 404 return 0; 406 405 } 407 406 … … 412 411 */ 413 412 HRESULT WINAPI SHDeleteValueA(HKEY hkey, LPCSTR pszSubKey, LPCSTR pszValue) { 414 HKEY subkey;415 HRESULT hres;413 HKEY subkey; 414 HRESULT hres; 416 415 417 416 hres = RegOpenKeyA(hkey,pszSubKey,&subkey); 418 417 if (hres) 419 return hres;418 return hres; 420 419 hres = RegDeleteValueA(subkey,pszValue); 421 420 RegCloseKey(subkey); … … 429 428 */ 430 429 HRESULT WINAPI SHDeleteValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue) { 431 HKEY subkey;432 HRESULT hres;430 HKEY subkey; 431 HRESULT hres; 433 432 434 433 hres = RegOpenKeyW(hkey,pszSubKey,&subkey); 435 434 if (hres) 436 return hres;435 return hres; 437 436 hres = RegDeleteValueW(subkey,pszValue); 438 437 RegCloseKey(subkey); -
trunk/src/shlwapi/regstream.c
r6650 r6712 1 /* $Id: regstream.c,v 1.3 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 * SHRegOpenStream2 * SHRegOpenStream 4 3 */ 5 4 #ifdef __WIN32OS2__ … … 29 28 DEFAULT_DEBUG_CHANNEL(shell); 30 29 31 typedef struct 32 { ICOM_VFIELD(IStream);33 DWORDref;34 HKEYhKey;35 LPBYTEpbBuffer;36 DWORDdwLength;37 DWORDdwPos;30 typedef struct 31 { ICOM_VFIELD(IStream); 32 DWORD ref; 33 HKEY hKey; 34 LPBYTE pbBuffer; 35 DWORD dwLength; 36 DWORD dwPos; 38 37 } ISHRegStream; 39 38 … … 41 40 42 41 /************************************************************************** 43 * IStream_ConstructorA [internal]42 * IStream_ConstructorA [internal] 44 43 */ 45 44 static IStream *IStream_ConstructorA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD grfMode) 46 45 { 47 ISHRegStream*rstr;48 DWORDdwType;49 50 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream));51 52 ICOM_VTBL(rstr)=&rstvt;53 rstr->ref = 1;54 55 if (!(RegOpenKeyExA (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey))))56 {57 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength))))58 { 59 /* read the binary data into the buffer */60 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength)))61 {62 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength))))63 {64 if (dwType == REG_BINARY )65 {66 TRACE ("%p\n", rstr);67 return (IStream*)rstr;68 }69 }70 HeapFree (GetProcessHeap(),0,rstr->pbBuffer);71 }72 }73 RegCloseKey(rstr->hKey);74 }75 HeapFree (GetProcessHeap(),0,rstr);76 return NULL;77 } 78 79 /************************************************************************** 80 * IStream_ConstructorW [internal]46 ISHRegStream* rstr; 47 DWORD dwType; 48 49 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream)); 50 51 ICOM_VTBL(rstr)=&rstvt; 52 rstr->ref = 1; 53 54 if (!(RegOpenKeyExA (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey)))) 55 { 56 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength)))) 57 { 58 /* read the binary data into the buffer */ 59 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength))) 60 { 61 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength)))) 62 { 63 if (dwType == REG_BINARY ) 64 { 65 TRACE ("%p\n", rstr); 66 return (IStream*)rstr; 67 } 68 } 69 HeapFree (GetProcessHeap(),0,rstr->pbBuffer); 70 } 71 } 72 RegCloseKey(rstr->hKey); 73 } 74 HeapFree (GetProcessHeap(),0,rstr); 75 return NULL; 76 } 77 78 /************************************************************************** 79 * IStream_ConstructorW [internal] 81 80 */ 82 81 static IStream *IStream_ConstructorW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD grfMode) 83 82 { 84 ISHRegStream*rstr;85 DWORDdwType;86 87 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream));88 89 ICOM_VTBL(rstr)=&rstvt;90 rstr->ref = 1;91 92 if (!(RegOpenKeyExW (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey))))93 {94 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength))))95 { 96 /* read the binary data into the buffer */97 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength)))98 {99 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength))))100 {101 if (dwType == REG_BINARY )102 {103 TRACE ("%p\n", rstr);104 return (IStream*)rstr;105 }106 }107 HeapFree (GetProcessHeap(),0,rstr->pbBuffer);108 }109 }110 RegCloseKey(rstr->hKey);111 }112 HeapFree (GetProcessHeap(),0,rstr);113 return NULL;83 ISHRegStream* rstr; 84 DWORD dwType; 85 86 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream)); 87 88 ICOM_VTBL(rstr)=&rstvt; 89 rstr->ref = 1; 90 91 if (!(RegOpenKeyExW (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey)))) 92 { 93 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength)))) 94 { 95 /* read the binary data into the buffer */ 96 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength))) 97 { 98 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength)))) 99 { 100 if (dwType == REG_BINARY ) 101 { 102 TRACE ("%p\n", rstr); 103 return (IStream*)rstr; 104 } 105 } 106 HeapFree (GetProcessHeap(),0,rstr->pbBuffer); 107 } 108 } 109 RegCloseKey(rstr->hKey); 110 } 111 HeapFree (GetProcessHeap(),0,rstr); 112 return NULL; 114 113 } 115 114 … … 119 118 static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj) 120 119 { 121 ICOM_THIS(ISHRegStream, iface);122 123 //// TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);124 125 *ppvObj = NULL;126 127 if(IsEqualIID(riid, &IID_IUnknown))/*IUnknown*/128 { *ppvObj = This; 129 }130 else if(IsEqualIID(riid, &IID_IStream))/*IStream*/131 { *ppvObj = This;132 } 133 134 if(*ppvObj)135 { 136 IStream_AddRef((IStream*)*ppvObj); 137 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);138 return S_OK;139 }140 TRACE("-- Interface: E_NOINTERFACE\n");141 return E_NOINTERFACE;120 ICOM_THIS(ISHRegStream, iface); 121 122 //// TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 123 124 *ppvObj = NULL; 125 126 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 127 { *ppvObj = This; 128 } 129 else if(IsEqualIID(riid, &IID_IStream)) /*IStream*/ 130 { *ppvObj = This; 131 } 132 133 if(*ppvObj) 134 { 135 IStream_AddRef((IStream*)*ppvObj); 136 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 137 return S_OK; 138 } 139 TRACE("-- Interface: E_NOINTERFACE\n"); 140 return E_NOINTERFACE; 142 141 } 143 142 … … 147 146 static ULONG WINAPI IStream_fnAddRef(IStream *iface) 148 147 { 149 ICOM_THIS(ISHRegStream, iface);150 151 TRACE("(%p)->(count=%lu)\n",This, This->ref);152 153 return ++(This->ref);148 ICOM_THIS(ISHRegStream, iface); 149 150 TRACE("(%p)->(count=%lu)\n",This, This->ref); 151 152 return ++(This->ref); 154 153 } 155 154 … … 159 158 static ULONG WINAPI IStream_fnRelease(IStream *iface) 160 159 { 161 ICOM_THIS(ISHRegStream, iface);162 163 TRACE("(%p)->()\n",This);164 165 if (!--(This->ref)) 166 { TRACE(" destroying SHReg IStream (%p)\n",This);167 168 if (This->pbBuffer)169 HeapFree(GetProcessHeap(),0,This->pbBuffer);170 171 if (This->hKey)172 RegCloseKey(This->hKey);173 174 HeapFree(GetProcessHeap(),0,This);175 return 0;176 }177 return This->ref;160 ICOM_THIS(ISHRegStream, iface); 161 162 TRACE("(%p)->()\n",This); 163 164 if (!--(This->ref)) 165 { TRACE(" destroying SHReg IStream (%p)\n",This); 166 167 if (This->pbBuffer) 168 HeapFree(GetProcessHeap(),0,This->pbBuffer); 169 170 if (This->hKey) 171 RegCloseKey(This->hKey); 172 173 HeapFree(GetProcessHeap(),0,This); 174 return 0; 175 } 176 return This->ref; 178 177 } 179 178 180 179 static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) 181 180 { 182 ICOM_THIS(ISHRegStream, iface);183 184 DWORD dwBytesToRead, dwBytesLeft;185 186 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead);187 188 if ( !pv )189 return STG_E_INVALIDPOINTER;190 191 dwBytesLeft = This->dwLength - This->dwPos;192 193 if ( 0 >= dwBytesLeft )/* end of buffer */194 return S_FALSE;195 196 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb;197 198 memmove ( pv, (This->pbBuffer) + (This->dwPos), dwBytesToRead);199 200 This->dwPos += dwBytesToRead;/* adjust pointer */201 202 if (pcbRead)203 *pcbRead = dwBytesToRead;204 205 return S_OK;181 ICOM_THIS(ISHRegStream, iface); 182 183 DWORD dwBytesToRead, dwBytesLeft; 184 185 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead); 186 187 if ( !pv ) 188 return STG_E_INVALIDPOINTER; 189 190 dwBytesLeft = This->dwLength - This->dwPos; 191 192 if ( 0 >= dwBytesLeft ) /* end of buffer */ 193 return S_FALSE; 194 195 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb; 196 197 memmove ( pv, (This->pbBuffer) + (This->dwPos), dwBytesToRead); 198 199 This->dwPos += dwBytesToRead; /* adjust pointer */ 200 201 if (pcbRead) 202 *pcbRead = dwBytesToRead; 203 204 return S_OK; 206 205 } 207 206 static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) 208 207 { 209 ICOM_THIS(ISHRegStream, iface);210 211 TRACE("(%p)\n",This);212 213 return E_NOTIMPL;208 ICOM_THIS(ISHRegStream, iface); 209 210 TRACE("(%p)\n",This); 211 212 return E_NOTIMPL; 214 213 } 215 214 static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 216 215 { 217 ICOM_THIS(ISHRegStream, iface);218 219 TRACE("(%p)\n",This);220 221 return E_NOTIMPL;216 ICOM_THIS(ISHRegStream, iface); 217 218 TRACE("(%p)\n",This); 219 220 return E_NOTIMPL; 222 221 } 223 222 static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) 224 223 { 225 ICOM_THIS(ISHRegStream, iface);226 227 TRACE("(%p)\n",This);228 229 return E_NOTIMPL;224 ICOM_THIS(ISHRegStream, iface); 225 226 TRACE("(%p)\n",This); 227 228 return E_NOTIMPL; 230 229 } 231 230 static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) 232 231 { 233 ICOM_THIS(ISHRegStream, iface);234 235 TRACE("(%p)\n",This);236 237 return E_NOTIMPL;232 ICOM_THIS(ISHRegStream, iface); 233 234 TRACE("(%p)\n",This); 235 236 return E_NOTIMPL; 238 237 } 239 238 static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) 240 239 { 241 ICOM_THIS(ISHRegStream, iface);242 243 TRACE("(%p)\n",This);244 245 return E_NOTIMPL;240 ICOM_THIS(ISHRegStream, iface); 241 242 TRACE("(%p)\n",This); 243 244 return E_NOTIMPL; 246 245 } 247 246 static HRESULT WINAPI IStream_fnRevert (IStream * iface) 248 247 { 249 ICOM_THIS(ISHRegStream, iface);250 251 TRACE("(%p)\n",This);252 253 return E_NOTIMPL;248 ICOM_THIS(ISHRegStream, iface); 249 250 TRACE("(%p)\n",This); 251 252 return E_NOTIMPL; 254 253 } 255 254 static HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 256 255 { 257 ICOM_THIS(ISHRegStream, iface);258 259 TRACE("(%p)\n",This);260 261 return E_NOTIMPL;256 ICOM_THIS(ISHRegStream, iface); 257 258 TRACE("(%p)\n",This); 259 260 return E_NOTIMPL; 262 261 } 263 262 static HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 264 263 { 265 ICOM_THIS(ISHRegStream, iface);266 267 TRACE("(%p)\n",This);268 269 return E_NOTIMPL;264 ICOM_THIS(ISHRegStream, iface); 265 266 TRACE("(%p)\n",This); 267 268 return E_NOTIMPL; 270 269 } 271 270 static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) 272 271 { 273 ICOM_THIS(ISHRegStream, iface);274 275 TRACE("(%p)\n",This);276 277 return E_NOTIMPL;272 ICOM_THIS(ISHRegStream, iface); 273 274 TRACE("(%p)\n",This); 275 276 return E_NOTIMPL; 278 277 } 279 278 static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) 280 279 { 281 ICOM_THIS(ISHRegStream, iface);282 283 TRACE("(%p)\n",This);284 285 return E_NOTIMPL;286 } 287 288 static struct ICOM_VTABLE(IStream) rstvt = 289 { 290 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE291 IStream_fnQueryInterface,292 IStream_fnAddRef,293 IStream_fnRelease,294 IStream_fnRead,295 IStream_fnWrite,296 IStream_fnSeek,297 IStream_fnSetSize,298 IStream_fnCopyTo,299 IStream_fnCommit,300 IStream_fnRevert,301 IStream_fnLockRegion,302 IStream_fnUnlockRegion,303 IStream_fnStat,304 IStream_fnClone305 280 ICOM_THIS(ISHRegStream, iface); 281 282 TRACE("(%p)\n",This); 283 284 return E_NOTIMPL; 285 } 286 287 static struct ICOM_VTABLE(IStream) rstvt = 288 { 289 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 290 IStream_fnQueryInterface, 291 IStream_fnAddRef, 292 IStream_fnRelease, 293 IStream_fnRead, 294 IStream_fnWrite, 295 IStream_fnSeek, 296 IStream_fnSetSize, 297 IStream_fnCopyTo, 298 IStream_fnCommit, 299 IStream_fnRevert, 300 IStream_fnLockRegion, 301 IStream_fnUnlockRegion, 302 IStream_fnStat, 303 IStream_fnClone 304 306 305 }; 307 306 308 307 /************************************************************************* 309 * SHOpenRegStreamA [SHLWAPI.@]308 * SHOpenRegStreamA [SHLWAPI.@] 310 309 */ 311 310 IStream * WINAPI SHOpenRegStreamA( 312 HKEY hkey,313 LPCSTR pszSubkey,314 LPCSTR pszValue,315 DWORD grfMode)316 { 317 TRACE("(0x%08x,%s,%s,0x%08lx)\n",318 hkey, pszSubkey, pszValue, grfMode);319 320 return IStream_ConstructorA(hkey, pszSubkey, pszValue, grfMode);311 HKEY hkey, 312 LPCSTR pszSubkey, 313 LPCSTR pszValue, 314 DWORD grfMode) 315 { 316 TRACE("(0x%08x,%s,%s,0x%08lx)\n", 317 hkey, pszSubkey, pszValue, grfMode); 318 319 return IStream_ConstructorA(hkey, pszSubkey, pszValue, grfMode); 321 320 } 322 321 323 322 /************************************************************************* 324 * SHOpenRegStreamW [SHLWAPI.@]323 * SHOpenRegStreamW [SHLWAPI.@] 325 324 */ 326 325 IStream * WINAPI SHOpenRegStreamW( 327 HKEY hkey,328 LPCWSTR pszSubkey,329 LPCWSTR pszValue,330 DWORD grfMode)331 { 332 TRACE("(0x%08x,%s,%s,0x%08lx)\n",333 hkey, debugstr_w(pszSubkey), debugstr_w(pszValue), grfMode);334 335 return IStream_ConstructorW(hkey, pszSubkey, pszValue, grfMode);336 } 326 HKEY hkey, 327 LPCWSTR pszSubkey, 328 LPCWSTR pszValue, 329 DWORD grfMode) 330 { 331 TRACE("(0x%08x,%s,%s,0x%08lx)\n", 332 hkey, debugstr_w(pszSubkey), debugstr_w(pszValue), grfMode); 333 334 return IStream_ConstructorW(hkey, pszSubkey, pszValue, grfMode); 335 } -
trunk/src/shlwapi/shlwapiguid.c
r6650 r6712 1 /* $Id: shlwapiguid.c,v 1.2 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 * SHRegOpenStream2 * SHRegOpenStream 4 3 */ 5 4 #ifdef __WIN32OS2__ -
trunk/src/shlwapi/string.c
r6650 r6712 1 /* $Id: string.c,v 1.5 2001-09-05 13:48:39 bird Exp $ */2 1 //Note: Odin changes marked by #ifdef __WIN32OS2__! 3 2 #ifdef __WIN32OS2__ … … 16 15 #endif 17 16 #include <ctype.h> 18 #include <stdlib.h> 17 #include <stdlib.h> 19 18 #include <stdio.h> 20 19 #include <string.h> … … 42 41 43 42 /************************************************************************* 44 * StrChrA [SHLWAPI]43 * StrChrA [SHLWAPI] 45 44 */ 46 45 LPSTR WINAPI StrChrA (LPCSTR str, WORD c) 47 46 { 48 TRACE("%s %i\n", str,c);49 return strchr(str, c);50 } 51 52 /************************************************************************* 53 * StrChrW [SHLWAPI]47 TRACE("%s %i\n", str,c); 48 return strchr(str, c); 49 } 50 51 /************************************************************************* 52 * StrChrW [SHLWAPI] 54 53 * 55 54 */ 56 55 LPWSTR WINAPI StrChrW (LPCWSTR str, WCHAR x ) 57 56 { 58 TRACE("%s 0x%04x\n",debugstr_w(str),x);59 return strchrW(str, x);57 TRACE("%s 0x%04x\n",debugstr_w(str),x); 58 return strchrW(str, x); 60 59 } 61 60 #ifndef __WIN32OS2__ 62 61 /************************************************************************* 63 * StrCmpIW [SHLWAPI]62 * StrCmpIW [SHLWAPI] 64 63 */ 65 64 int WINAPI StrCmpIW ( LPCWSTR wstr1, LPCWSTR wstr2 ) … … 71 70 72 71 /************************************************************************* 73 * StrCmpNA [SHLWAPI]72 * StrCmpNA [SHLWAPI] 74 73 */ 75 74 INT WINAPI StrCmpNA ( LPCSTR str1, LPCSTR str2, INT len) 76 75 { 77 TRACE("%s %s %i stub\n", str1,str2,len);78 return strncmp(str1, str2, len);79 } 80 81 /************************************************************************* 82 * StrCmpNW [SHLWAPI]76 TRACE("%s %s %i stub\n", str1,str2,len); 77 return strncmp(str1, str2, len); 78 } 79 80 /************************************************************************* 81 * StrCmpNW [SHLWAPI] 83 82 */ 84 83 INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len) 85 84 { 86 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);87 return strncmpW(wstr1, wstr2, len);88 } 89 90 /************************************************************************* 91 * StrCmpNIA [SHLWAPI]85 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); 86 return strncmpW(wstr1, wstr2, len); 87 } 88 89 /************************************************************************* 90 * StrCmpNIA [SHLWAPI] 92 91 */ 93 92 int WINAPI StrCmpNIA ( LPCSTR str1, LPCSTR str2, int len) 94 93 { 95 TRACE("%s %s %i stub\n", str1,str2,len);96 return strncasecmp(str1, str2, len);97 } 98 99 /************************************************************************* 100 * StrCmpNIW [SHLWAPI]94 TRACE("%s %s %i stub\n", str1,str2,len); 95 return strncasecmp(str1, str2, len); 96 } 97 98 /************************************************************************* 99 * StrCmpNIW [SHLWAPI] 101 100 */ 102 101 int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len) 103 102 { 104 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);105 return strncmpiW(wstr1, wstr2, len);106 } 107 108 /************************************************************************* 109 * StrCmpW [SHLWAPI]103 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); 104 return strncmpiW(wstr1, wstr2, len); 105 } 106 107 /************************************************************************* 108 * StrCmpW [SHLWAPI] 110 109 */ 111 110 int WINAPI StrCmpW ( LPCWSTR wstr1, LPCWSTR wstr2 ) … … 116 115 117 116 /************************************************************************* 118 * StrCatW [SHLWAPI]117 * StrCatW [SHLWAPI] 119 118 */ 120 119 LPWSTR WINAPI StrCatW( LPWSTR wstr1, LPCWSTR wstr2 ) … … 125 124 126 125 /************************************************************************* 127 * StrCpyW [SHLWAPI]126 * StrCpyW [SHLWAPI] 128 127 */ 129 128 LPWSTR WINAPI StrCpyW( LPWSTR wstr1, LPCWSTR wstr2 ) … … 134 133 135 134 /************************************************************************* 136 * StrCpyNW [SHLWAPI]135 * StrCpyNW [SHLWAPI] 137 136 */ 138 137 LPWSTR WINAPI StrCpyNW( LPWSTR wstr1, LPCWSTR wstr2, int n ) … … 143 142 144 143 /************************************************************************* 145 * StrStrA [SHLWAPI]144 * StrStrA [SHLWAPI] 146 145 */ 147 146 LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch) … … 158 157 159 158 /************************************************************************* 160 * StrStrW [SHLWAPI]159 * StrStrW [SHLWAPI] 161 160 */ 162 161 LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch) … … 173 172 174 173 /************************************************************************* 175 * StrStrIA [SHLWAPI]174 * StrStrIA [SHLWAPI] 176 175 */ 177 176 LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch) … … 188 187 189 188 /************************************************************************* 190 * StrStrIW [SHLWAPI]189 * StrStrIW [SHLWAPI] 191 190 */ 192 191 LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch) … … 203 202 204 203 /************************************************************************* 205 * StrToIntA[SHLWAPI]204 * StrToIntA [SHLWAPI] 206 205 */ 207 206 int WINAPI StrToIntA(LPCSTR lpSrc) 208 207 { 209 TRACE("%s\n", lpSrc);210 return atol(lpSrc);211 } 212 213 /************************************************************************* 214 * StrToIntW[SHLWAPI]208 TRACE("%s\n", lpSrc); 209 return atol(lpSrc); 210 } 211 212 /************************************************************************* 213 * StrToIntW [SHLWAPI] 215 214 */ 216 215 int WINAPI StrToIntW(LPCWSTR lpSrc) … … 225 224 226 225 /************************************************************************* 227 * StrToIntExA[SHLWAPI]226 * StrToIntExA [SHLWAPI] 228 227 */ 229 228 BOOL WINAPI StrToIntExA( LPCSTR pszString, DWORD dwFlags, LPINT piRet) 230 229 { 231 TRACE("%s %ld stub !\n", debugstr_a(pszString), dwFlags);232 piRet = (LPINT) StrToIntA(pszString);233 return TRUE;234 } 235 236 /************************************************************************* 237 * StrToIntExW[SHLWAPI]230 TRACE("%s %ld stub !\n", debugstr_a(pszString), dwFlags); 231 piRet = (LPINT) StrToIntA(pszString); 232 return TRUE; 233 } 234 235 /************************************************************************* 236 * StrToIntExW [SHLWAPI] 238 237 */ 239 238 BOOL WINAPI StrToIntExW( LPCWSTR pszString, DWORD dwFlags, LPINT piRet) 240 239 { 241 TRACE("%s %ld stub !\n", debugstr_w(pszString), dwFlags);242 piRet = (LPINT) StrToIntW(pszString);243 return TRUE;244 } 245 246 /************************************************************************* 247 * StrDupA[SHLWAPI]240 TRACE("%s %ld stub !\n", debugstr_w(pszString), dwFlags); 241 piRet = (LPINT) StrToIntW(pszString); 242 return TRUE; 243 } 244 245 /************************************************************************* 246 * StrDupA [SHLWAPI] 248 247 */ 249 248 LPSTR WINAPI StrDupA (LPCSTR lpSrc) 250 249 { 251 int len = strlen(lpSrc);252 LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1);253 254 TRACE("%s\n", lpSrc);255 256 if (lpDest) strcpy(lpDest, lpSrc);257 return lpDest;258 } 259 260 /************************************************************************* 261 * StrDupW[SHLWAPI]250 int len = strlen(lpSrc); 251 LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1); 252 253 TRACE("%s\n", lpSrc); 254 255 if (lpDest) strcpy(lpDest, lpSrc); 256 return lpDest; 257 } 258 259 /************************************************************************* 260 * StrDupW [SHLWAPI] 262 261 */ 263 262 LPWSTR WINAPI StrDupW (LPCWSTR lpSrc) 264 263 { 265 int len = strlenW(lpSrc);266 LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1));267 268 TRACE("%s\n", debugstr_w(lpSrc));269 270 if (lpDest) strcpyW(lpDest, lpSrc);271 return lpDest;272 } 273 274 /************************************************************************* 275 * StrCSpnA[SHLWAPI]264 int len = strlenW(lpSrc); 265 LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1)); 266 267 TRACE("%s\n", debugstr_w(lpSrc)); 268 269 if (lpDest) strcpyW(lpDest, lpSrc); 270 return lpDest; 271 } 272 273 /************************************************************************* 274 * StrCSpnA [SHLWAPI] 276 275 */ 277 276 int WINAPI StrCSpnA (LPCSTR lpStr, LPCSTR lpSet) 278 277 { 279 int i,j, pos = strlen(lpStr);280 281 TRACE("(%p %s %p %s)\n",282 lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet));283 284 for (i=0; i < strlen(lpSet) ; i++ )285 {286 for (j = 0; j < pos;j++)287 {288 if (lpStr[j] == lpSet[i])289 {290 pos = j;291 }292 }293 } 294 TRACE("-- %u\n", pos);295 return pos; 296 } 297 298 /************************************************************************* 299 * StrCSpnW[SHLWAPI]278 int i,j, pos = strlen(lpStr); 279 280 TRACE("(%p %s %p %s)\n", 281 lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet)); 282 283 for (i=0; i < strlen(lpSet) ; i++ ) 284 { 285 for (j = 0; j < pos;j++) 286 { 287 if (lpStr[j] == lpSet[i]) 288 { 289 pos = j; 290 } 291 } 292 } 293 TRACE("-- %u\n", pos); 294 return pos; 295 } 296 297 /************************************************************************* 298 * StrCSpnW [SHLWAPI] 300 299 */ 301 300 int WINAPI StrCSpnW (LPCWSTR lpStr, LPCWSTR lpSet) 302 301 { 303 int i,j, pos = strlenW(lpStr);304 305 TRACE("(%p %s %p %s)\n",306 lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet));307 308 for (i=0; i < strlenW(lpSet) ; i++ )309 {310 for (j = 0; j < pos;j++)311 {312 if (lpStr[j] == lpSet[i])313 {314 pos = j;315 }316 }317 } 318 TRACE("-- %u\n", pos);319 return pos; 302 int i,j, pos = strlenW(lpStr); 303 304 TRACE("(%p %s %p %s)\n", 305 lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet)); 306 307 for (i=0; i < strlenW(lpSet) ; i++ ) 308 { 309 for (j = 0; j < pos;j++) 310 { 311 if (lpStr[j] == lpSet[i]) 312 { 313 pos = j; 314 } 315 } 316 } 317 TRACE("-- %u\n", pos); 318 return pos; 320 319 } 321 320 … … 338 337 if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue; 339 338 lpGotIt = lpStart; 340 } 339 } 341 340 return (LPSTR)lpGotIt; 342 341 } … … 362 361 363 362 /************************************************************************* 364 * StrCatBuffA[SHLWAPI]363 * StrCatBuffA [SHLWAPI] 365 364 * 366 365 * Appends back onto front, stopping when front is size-1 characters long. … … 380 379 381 380 /************************************************************************* 382 * StrCatBuffW[SHLWAPI]381 * StrCatBuffW [SHLWAPI] 383 382 * 384 383 * Appends back onto front, stopping when front is size-1 characters long. … … 398 397 399 398 /************************************************************************* 400 * StrRetToBufA [SHLWAPI.@]401 * 399 * StrRetToBufA [SHLWAPI.@] 400 * 402 401 * converts a STRRET to a normal string 403 402 * … … 407 406 HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len) 408 407 { 409 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);410 411 switch (src->uType)412 {413 case STRRET_WSTR:414 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);415 /* SHFree(src->u.pOleStr); FIXME: is this right? */416 break;417 418 case STRRET_CSTRA:419 lstrcpynA((LPSTR)dest, src->u.cStr, len);420 break;421 422 case STRRET_OFFSETA:423 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);424 break;425 426 default:427 FIXME("unknown type!\n");428 if (len)429 {430 *(LPSTR)dest = '\0';431 }432 return(FALSE);433 }434 return S_OK;435 } 436 437 /************************************************************************* 438 * StrRetToBufW [SHLWAPI.@]439 * 408 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); 409 410 switch (src->uType) 411 { 412 case STRRET_WSTR: 413 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); 414 /* SHFree(src->u.pOleStr); FIXME: is this right? */ 415 break; 416 417 case STRRET_CSTRA: 418 lstrcpynA((LPSTR)dest, src->u.cStr, len); 419 break; 420 421 case STRRET_OFFSETA: 422 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); 423 break; 424 425 default: 426 FIXME("unknown type!\n"); 427 if (len) 428 { 429 *(LPSTR)dest = '\0'; 430 } 431 return(FALSE); 432 } 433 return S_OK; 434 } 435 436 /************************************************************************* 437 * StrRetToBufW [SHLWAPI.@] 438 * 440 439 * converts a STRRET to a normal string 441 440 * … … 445 444 HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len) 446 445 { 447 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);448 449 switch (src->uType)450 {451 case STRRET_WSTR:452 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);453 /* SHFree(src->u.pOleStr); FIXME: is this right? */454 break;455 456 case STRRET_CSTRA:446 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); 447 448 switch (src->uType) 449 { 450 case STRRET_WSTR: 451 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); 452 /* SHFree(src->u.pOleStr); FIXME: is this right? */ 453 break; 454 455 case STRRET_CSTRA: 457 456 if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len) 458 457 dest[len-1] = 0; 459 break;460 461 case STRRET_OFFSETA:462 if (pidl)463 {458 break; 459 460 case STRRET_OFFSETA: 461 if (pidl) 462 { 464 463 if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, 465 464 dest, len ) && len) 466 465 dest[len-1] = 0; 467 }468 break;469 470 default:471 FIXME("unknown type!\n");472 if (len)473 { *(LPSTR)dest = '\0';474 }475 return(FALSE);476 }477 return S_OK;478 } 479 480 /************************************************************************* 481 * StrFormatByteSizeA [SHLWAPI]466 } 467 break; 468 469 default: 470 FIXME("unknown type!\n"); 471 if (len) 472 { *(LPSTR)dest = '\0'; 473 } 474 return(FALSE); 475 } 476 return S_OK; 477 } 478 479 /************************************************************************* 480 * StrFormatByteSizeA [SHLWAPI] 482 481 */ 483 482 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ) 484 { char buf[64];485 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);486 if ( dw<1024L )487 { sprintf (buf,"%ld bytes", dw);488 }489 else if ( dw<1048576L)490 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);491 }492 else if ( dw < 1073741824L)493 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);494 }495 else496 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);497 }498 lstrcpynA (pszBuf, buf, cchBuf);499 return pszBuf; 500 } 501 502 /************************************************************************* 503 * StrFormatByteSizeW [SHLWAPI]483 { char buf[64]; 484 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); 485 if ( dw<1024L ) 486 { sprintf (buf,"%ld bytes", dw); 487 } 488 else if ( dw<1048576L) 489 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); 490 } 491 else if ( dw < 1073741824L) 492 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); 493 } 494 else 495 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); 496 } 497 lstrcpynA (pszBuf, buf, cchBuf); 498 return pszBuf; 499 } 500 501 /************************************************************************* 502 * StrFormatByteSizeW [SHLWAPI] 504 503 */ 505 504 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ) … … 513 512 514 513 /************************************************************************* 515 * StrNCatA [SHLWAPI]514 * StrNCatA [SHLWAPI] 516 515 */ 517 516 LPSTR WINAPI StrNCatA(LPSTR front, LPCSTR back, INT cchMax) 518 517 { 519 TRACE("%s %s %i stub\n", debugstr_a(front),debugstr_a(back),cchMax);520 return (front);521 } 522 523 /************************************************************************* 524 * StrNCatW [SHLWAPI]518 TRACE("%s %s %i stub\n", debugstr_a(front),debugstr_a(back),cchMax); 519 return (front); 520 } 521 522 /************************************************************************* 523 * StrNCatW [SHLWAPI] 525 524 */ 526 525 LPWSTR WINAPI StrNCatW(LPWSTR front, LPCWSTR back, INT cchMax) 527 526 { 528 TRACE("%s %s %i stub\n", debugstr_w(front),debugstr_w(back),cchMax);529 return (front);530 } 531 532 /************************************************************************* 533 * StrTrimA [SHLWAPI.@]527 TRACE("%s %s %i stub\n", debugstr_w(front),debugstr_w(back),cchMax); 528 return (front); 529 } 530 531 /************************************************************************* 532 * StrTrimA [SHLWAPI.@] 534 533 */ 535 534 BOOL WINAPI StrTrimA(LPSTR pszSource, LPCSTR pszTrimChars) … … 542 541 for (pTrim = pszTrimChars; *pTrim; pTrim++) 543 542 { 544 for (pSrc = pszSource; *pSrc; pSrc++)545 if (*pSrc == *pTrim)546 {547 /* match -> remove this char.548 * strlen(pSrc) equiv. to the correct strlen(pSrc+1)+1 */549 memmove(pSrc, pSrc+1, strlen(pSrc));550 trimmed = TRUE;551 }543 for (pSrc = pszSource; *pSrc; pSrc++) 544 if (*pSrc == *pTrim) 545 { 546 /* match -> remove this char. 547 * strlen(pSrc) equiv. to the correct strlen(pSrc+1)+1 */ 548 memmove(pSrc, pSrc+1, strlen(pSrc)); 549 trimmed = TRUE; 550 } 552 551 } 553 552 TRACE("<- '%s'\n", pszSource); … … 556 555 557 556 /************************************************************************* 558 * wnsprintfA [SHLWAPI]557 * wnsprintfA [SHLWAPI] 559 558 */ 560 559 int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...) … … 570 569 571 570 /************************************************************************* 572 * wnsprintfW [SHLWAPI]571 * wnsprintfW [SHLWAPI] 573 572 */ 574 573 int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...) -
trunk/src/shlwapi/url.c
r6650 r6712 1 /* $Id: url.c,v 1.4 2001-09-05 13:48:39 bird Exp $ */2 1 /* 3 2 * Url functions … … 54 53 if(dwFlags & URL_ESCAPE_SPACES_ONLY) { 55 54 if(ch == ' ') 56 return TRUE;57 else58 return FALSE;55 return TRUE; 56 else 57 return FALSE; 59 58 } 60 59 61 60 if (ch <= 31 || ch >= 127) 62 return TRUE;61 return TRUE; 63 62 64 63 else { 65 64 switch (ch) { 66 case ' ':67 case '<':68 case '>':69 case '\"':70 case '{':71 case '}':72 case '|':73 case '\\':74 case '^':75 case ']':76 case '[':77 case '`':78 case '&':79 return TRUE;80 81 default:82 return FALSE;83 }65 case ' ': 66 case '<': 67 case '>': 68 case '\"': 69 case '{': 70 case '}': 71 case '|': 72 case '\\': 73 case '^': 74 case ']': 75 case '[': 76 case '`': 77 case '&': 78 return TRUE; 79 80 default: 81 return FALSE; 82 } 84 83 } 85 84 } … … 89 88 */ 90 89 HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized, 91 LPDWORD pcchCanonicalized, DWORD dwFlags)90 LPDWORD pcchCanonicalized, DWORD dwFlags) 92 91 { 93 92 HRESULT hr = S_OK; … … 97 96 98 97 TRACE("(%s %p %p 0x%08lx)\n", debugstr_a(pszUrl), pszCanonicalized, 99 pcchCanonicalized, dwFlags);98 pcchCanonicalized, dwFlags); 100 99 101 100 nLen = strlen(pszUrl); … … 114 113 if(dwFlags & (URL_ESCAPE_UNSAFE | URL_ESCAPE_SPACES_ONLY)) { 115 114 DWORD EscapeFlags = dwFlags & (URL_ESCAPE_SPACES_ONLY 116 /* | URL_ESCAPE_PERCENT */);117 hr = UrlEscapeA(lpszUrlCpy, pszCanonicalized, pcchCanonicalized,118 EscapeFlags);115 /* | URL_ESCAPE_PERCENT */); 116 hr = UrlEscapeA(lpszUrlCpy, pszCanonicalized, pcchCanonicalized, 117 EscapeFlags); 119 118 } else { /* No escapping needed, just copy the string */ 120 119 nLen = strlen(lpszUrlCpy); 121 if(nLen < *pcchCanonicalized)122 memcpy(pszCanonicalized, lpszUrlCpy, nLen + 1);123 else {124 hr = E_POINTER;125 nLen++;126 }127 *pcchCanonicalized = nLen;120 if(nLen < *pcchCanonicalized) 121 memcpy(pszCanonicalized, lpszUrlCpy, nLen + 1); 122 else { 123 hr = E_POINTER; 124 nLen++; 125 } 126 *pcchCanonicalized = nLen; 128 127 } 129 128 130 129 HeapFree(GetProcessHeap(), 0, lpszUrlCpy); 131 130 132 131 return hr; 133 132 } … … 136 135 * UrlCanonicalizeW [SHLWAPI] 137 136 */ 138 HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, 139 LPDWORD pcchCanonicalized, DWORD dwFlags)137 HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, 138 LPDWORD pcchCanonicalized, DWORD dwFlags) 140 139 { 141 140 FIXME("(%s %p %p 0x%08lx): stub\n",debugstr_w(pszUrl), 142 pszCanonicalized, pcchCanonicalized, dwFlags);141 pszCanonicalized, pcchCanonicalized, dwFlags); 143 142 return E_NOTIMPL; 144 143 } 145 144 146 145 /************************************************************************* 147 * UrlEscapeA [SHLWAPI]146 * UrlEscapeA [SHLWAPI] 148 147 * 149 148 * Converts unsafe characters into their escape sequences. … … 173 172 */ 174 173 HRESULT WINAPI UrlEscapeA( 175 LPCSTR pszUrl,176 LPSTR pszEscaped,177 LPDWORD pcchEscaped,178 DWORD dwFlags)174 LPCSTR pszUrl, 175 LPSTR pszEscaped, 176 LPDWORD pcchEscaped, 177 DWORD dwFlags) 179 178 { 180 179 LPCSTR src; … … 186 185 187 186 TRACE("(%s %p %p 0x%08lx)\n", debugstr_a(pszUrl), pszEscaped, 188 pcchEscaped, dwFlags);187 pcchEscaped, dwFlags); 189 188 190 189 if(dwFlags & ~URL_ESCAPE_SPACES_ONLY) … … 193 192 for(src = pszUrl; *src; src++) { 194 193 if(!(dwFlags & URL_ESCAPE_SPACES_ONLY) && 195 (*src == '#' || *src == '?'))196 stop_escapping = TRUE;197 198 if(URL_NeedEscape(*src, dwFlags) && stop_escapping == FALSE) {199 next[0] = '%';200 next[1] = hex[(*src >> 4) & 0xf];201 next[2] = hex[*src & 0xf];202 len = 3;203 } else {204 next[0] = *src;205 len = 1;206 }207 208 if(needed + len <= *pcchEscaped) {209 memcpy(dst, next, len);210 dst += len;211 }212 needed += len;194 (*src == '#' || *src == '?')) 195 stop_escapping = TRUE; 196 197 if(URL_NeedEscape(*src, dwFlags) && stop_escapping == FALSE) { 198 next[0] = '%'; 199 next[1] = hex[(*src >> 4) & 0xf]; 200 next[2] = hex[*src & 0xf]; 201 len = 3; 202 } else { 203 next[0] = *src; 204 len = 1; 205 } 206 207 if(needed + len <= *pcchEscaped) { 208 memcpy(dst, next, len); 209 dst += len; 210 } 211 needed += len; 213 212 } 214 213 215 214 if(needed < *pcchEscaped) { 216 215 *dst = '\0'; 217 ret = S_OK;216 ret = S_OK; 218 217 } else { 219 218 needed++; /* add one for the '\0' */ 220 ret = E_POINTER;219 ret = E_POINTER; 221 220 } 222 221 *pcchEscaped = needed; 223 222 return ret; 224 } 225 226 /************************************************************************* 227 * UrlEscapeW [SHLWAPI]223 } 224 225 /************************************************************************* 226 * UrlEscapeW [SHLWAPI] 228 227 */ 229 228 HRESULT WINAPI UrlEscapeW( 230 LPCWSTR pszUrl,231 LPWSTR pszEscaped,232 LPDWORD pcchEscaped,233 DWORD dwFlags)229 LPCWSTR pszUrl, 230 LPWSTR pszEscaped, 231 LPDWORD pcchEscaped, 232 DWORD dwFlags) 234 233 { 235 234 FIXME("(%s %p %p 0x%08lx): stub\n",debugstr_w(pszUrl), 236 pszEscaped, pcchEscaped, dwFlags);235 pszEscaped, pcchEscaped, dwFlags); 237 236 return E_NOTIMPL; 238 237 } … … 240 239 241 240 /************************************************************************* 242 * UrlUnescapeA [SHLWAPI]241 * UrlUnescapeA [SHLWAPI] 243 242 * 244 243 * Converts escape sequences back to ordinary characters. 245 * 244 * 246 245 * If URL_ESCAPE_INPLACE is set in dwFlags then pszUnescaped and 247 246 * pcchUnescaped are ignored and the converted string is returned in … … 257 256 */ 258 257 HRESULT WINAPI UrlUnescapeA( 259 LPCSTR pszUrl,260 LPSTR pszUnescaped,261 LPDWORD pcchUnescaped,262 DWORD dwFlags)258 LPCSTR pszUrl, 259 LPSTR pszUnescaped, 260 LPDWORD pcchUnescaped, 261 DWORD dwFlags) 263 262 { 264 263 char *dst, next; … … 269 268 270 269 TRACE("(%s, %p, %p, %08lx): stub\n", debugstr_a(pszUrl), pszUnescaped, 271 pcchUnescaped, dwFlags);270 pcchUnescaped, dwFlags); 272 271 273 272 if(dwFlags & URL_UNESCAPE_INPLACE) … … 278 277 for(src = pszUrl, needed = 0; *src; src++, needed++) { 279 278 if(dwFlags & URL_DONT_UNESCAPE_EXTRA_INFO && 280 (*src == '#' || *src == '?')) {281 stop_unescapping = TRUE;282 next = *src;283 } else if(*src == '%' && isxdigit(*(src + 1)) && isxdigit(*(src + 2))284 && stop_unescapping == FALSE) {285 INT ih;286 char buf[3];287 memcpy(buf, src + 1, 2);288 buf[2] = '\0';289 ih = strtol(buf, NULL, 16);290 next = (CHAR) ih;291 src += 2; /* Advance to end of escape */292 } else293 next = *src;294 295 if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped)296 *dst++ = next;279 (*src == '#' || *src == '?')) { 280 stop_unescapping = TRUE; 281 next = *src; 282 } else if(*src == '%' && isxdigit(*(src + 1)) && isxdigit(*(src + 2)) 283 && stop_unescapping == FALSE) { 284 INT ih; 285 char buf[3]; 286 memcpy(buf, src + 1, 2); 287 buf[2] = '\0'; 288 ih = strtol(buf, NULL, 16); 289 next = (CHAR) ih; 290 src += 2; /* Advance to end of escape */ 291 } else 292 next = *src; 293 294 if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped) 295 *dst++ = next; 297 296 } 298 297 299 298 if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped) { 300 299 *dst = '\0'; 301 ret = S_OK;300 ret = S_OK; 302 301 } else { 303 302 needed++; /* add one for the '\0' */ 304 ret = E_POINTER;303 ret = E_POINTER; 305 304 } 306 305 if(!(dwFlags & URL_UNESCAPE_INPLACE)) … … 311 310 312 311 /************************************************************************* 313 * UrlUnescapeW [SHLWAPI]312 * UrlUnescapeW [SHLWAPI] 314 313 */ 315 314 HRESULT WINAPI UrlUnescapeW( 316 LPCWSTR pszUrl,317 LPWSTR pszUnescaped,318 LPDWORD pcchUnescaped,319 DWORD dwFlags)315 LPCWSTR pszUrl, 316 LPWSTR pszUnescaped, 317 LPDWORD pcchUnescaped, 318 DWORD dwFlags) 320 319 { 321 320 FIXME("(%s, %p, %p, %08lx): stub\n", debugstr_w(pszUrl), pszUnescaped, 322 pcchUnescaped, dwFlags);321 pcchUnescaped, dwFlags); 323 322 return E_NOTIMPL; 324 323 } 325 324 326 325 /************************************************************************* 327 * HashData [SHLWAPI]326 * HashData [SHLWAPI] 328 327 * 329 328 * Hash an input block into a variable sized digest. … … 358 357 359 358 /************************************************************************* 360 * UrlHashA [SHLWAPI]359 * UrlHashA [SHLWAPI] 361 360 * 362 361 * Hash an ASCII URL. … … 372 371 373 372 /************************************************************************* 374 * UrlApplySchemeW [SHLWAPI.@]373 * UrlApplySchemeW [SHLWAPI.@] 375 374 */ 376 375 HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwFlags)
Note:
See TracChangeset
for help on using the changeset viewer.
