| 1 | /* $Id: guid.c,v 1.4 2001-08-04 17:19:20 sandervl Exp $ */ | 
|---|
| 2 | #define ICOM_CINTERFACE 1 | 
|---|
| 3 | #include <odin.h> | 
|---|
| 4 |  | 
|---|
| 5 | #define CINTERFACE 1 | 
|---|
| 6 | #define INITGUID | 
|---|
| 7 | #include <wine\obj_oleview.h> | 
|---|
| 8 | #include "initguid.h" | 
|---|
| 9 |  | 
|---|
| 10 | #include "shlwapi.h" | 
|---|
| 11 | #include "shlguid.h" | 
|---|
| 12 | #include "shlobj.h" | 
|---|
| 13 | #include "docobj.h" | 
|---|
| 14 | #include "..\shell32\shellfolder.h" | 
|---|
| 15 |  | 
|---|
| 16 | #include "wine/obj_inplace.h" | 
|---|
| 17 | #include "wine/obj_oleobj.h" | 
|---|
| 18 | #include "wine/obj_surrogate.h" | 
|---|
| 19 | #include "wine/obj_errorinfo.h" | 
|---|
| 20 | #include "wine/obj_oleview.h" | 
|---|
| 21 | #include "wine/obj_clientserver.h" | 
|---|
| 22 | #include "wine/obj_cache.h" | 
|---|
| 23 | #include "wine\obj_oleaut.h" | 
|---|
| 24 | #include "wine\obj_olefont.h" | 
|---|
| 25 |  | 
|---|
| 26 | #include <wine/obj_oleview.h> | 
|---|
| 27 | #include <wine/obj_dragdrop.h> | 
|---|
| 28 | #include <wine/obj_inplace.h> | 
|---|
| 29 | #include <wine/obj_control.h> | 
|---|
| 30 | #include <wine/obj_shellfolder.h> | 
|---|
| 31 | #include <wine/obj_shelllink.h> | 
|---|
| 32 | #include <wine/obj_contextmenu.h> | 
|---|
| 33 | #include <wine/obj_commdlgbrowser.h> | 
|---|
| 34 | #include <wine/obj_extracticon.h> | 
|---|
| 35 | #include <wine/obj_shellextinit.h> | 
|---|
| 36 | #include <wine/obj_shellbrowser.h> | 
|---|
| 37 | #include <wine/obj_serviceprovider.h> | 
|---|
| 38 | #include <wine/unicode.h> | 
|---|
| 39 |  | 
|---|
| 40 | #include <misc.h> | 
|---|
| 41 |  | 
|---|
| 42 | /********************************************************************* | 
|---|
| 43 | *           CRTDLL__wcsnicmp    (CRTDLL.321) | 
|---|
| 44 | */ | 
|---|
| 45 | int CDECL CRTDLL__wcsnicmp(LPCWSTR str1, LPCWSTR str2, int n) | 
|---|
| 46 | { | 
|---|
| 47 | if (!n) return 0; | 
|---|
| 48 | while ((--n > 0) && *str1 && (towupper(*str1) == towupper(*str2))) | 
|---|
| 49 | { | 
|---|
| 50 | str1++; | 
|---|
| 51 | str2++; | 
|---|
| 52 | } | 
|---|
| 53 | return toupperW(*str1) - toupperW(*str2); | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 | /********************************************************************* | 
|---|
| 57 | *           wcstombs    (NTDLL.@) | 
|---|
| 58 | */ | 
|---|
| 59 | INT __cdecl NTDLL_wcstombs( LPSTR dst, LPCWSTR src, INT n ) | 
|---|
| 60 | { | 
|---|
| 61 | INT ret; | 
|---|
| 62 | if (n <= 0) return 0; | 
|---|
| 63 | ret = WideCharToMultiByte( CP_ACP, 0, src, -1, dst, dst ? n : 0, NULL, NULL ); | 
|---|
| 64 | if (!ret) return n;  /* overflow */ | 
|---|
| 65 | return ret - 1;  /* do not count terminating NULL */ | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | /********************************************************************* | 
|---|
| 69 | *           _wtol    (NTDLL.@) | 
|---|
| 70 | * Like atol, but for wide character strings. | 
|---|
| 71 | */ | 
|---|
| 72 | LONG __cdecl _wtol(LPWSTR string) | 
|---|
| 73 | { | 
|---|
| 74 | char buffer[30]; | 
|---|
| 75 | NTDLL_wcstombs( buffer, string, sizeof(buffer) ); | 
|---|
| 76 | return atol( buffer ); | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | /********************************************************************* | 
|---|
| 80 | *           _wtoi    (NTDLL.@) | 
|---|
| 81 | */ | 
|---|
| 82 | INT __cdecl _wtoi(LPWSTR string) | 
|---|
| 83 | { | 
|---|
| 84 | return _wtol(string); | 
|---|
| 85 | } | 
|---|
| 86 |  | 
|---|
| 87 | /****************************************************************************** | 
|---|
| 88 | *  RtlAllocateAndInitializeSid             [NTDLL.265] | 
|---|
| 89 | * | 
|---|
| 90 | */ | 
|---|
| 91 | BOOLEAN WINAPI RtlAllocateAndInitializeSid ( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, | 
|---|
| 92 | BYTE nSubAuthorityCount, | 
|---|
| 93 | DWORD nSubAuthority0, | 
|---|
| 94 | DWORD nSubAuthority1, | 
|---|
| 95 | DWORD nSubAuthority2, | 
|---|
| 96 | DWORD nSubAuthority3, | 
|---|
| 97 | DWORD nSubAuthority4, | 
|---|
| 98 | DWORD nSubAuthority5, | 
|---|
| 99 | DWORD nSubAuthority6, | 
|---|
| 100 | DWORD nSubAuthority7, | 
|---|
| 101 | PSID *pSid) | 
|---|
| 102 | { | 
|---|
| 103 | dprintf(("NTDLL: RtlAllocateAndInitializeSid(%08xh,%08xh,%08xh," | 
|---|
| 104 | "%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)", | 
|---|
| 105 | pIdentifierAuthority, | 
|---|
| 106 | nSubAuthorityCount, | 
|---|
| 107 | nSubAuthority0, | 
|---|
| 108 | nSubAuthority1, | 
|---|
| 109 | nSubAuthority2, | 
|---|
| 110 | nSubAuthority3, | 
|---|
| 111 | nSubAuthority4, | 
|---|
| 112 | nSubAuthority5, | 
|---|
| 113 | nSubAuthority6, | 
|---|
| 114 | nSubAuthority7, | 
|---|
| 115 | pSid)); | 
|---|
| 116 |  | 
|---|
| 117 | *pSid = (PSID)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SID)+nSubAuthorityCount*sizeof(DWORD)); | 
|---|
| 118 | if(*pSid == NULL) { | 
|---|
| 119 | SetLastError(ERROR_NOT_ENOUGH_MEMORY); | 
|---|
| 120 | return FALSE; | 
|---|
| 121 | } | 
|---|
| 122 | (*pSid)->Revision          = SID_REVISION; | 
|---|
| 123 | (*pSid)->SubAuthorityCount = nSubAuthorityCount; | 
|---|
| 124 |  | 
|---|
| 125 | if (nSubAuthorityCount > 0) | 
|---|
| 126 | (*pSid)->SubAuthority[0] = nSubAuthority0; | 
|---|
| 127 | if (nSubAuthorityCount > 1) | 
|---|
| 128 | (*pSid)->SubAuthority[1] = nSubAuthority1; | 
|---|
| 129 | if (nSubAuthorityCount > 2) | 
|---|
| 130 | (*pSid)->SubAuthority[2] = nSubAuthority2; | 
|---|
| 131 | if (nSubAuthorityCount > 3) | 
|---|
| 132 | (*pSid)->SubAuthority[3] = nSubAuthority3; | 
|---|
| 133 | if (nSubAuthorityCount > 4) | 
|---|
| 134 | (*pSid)->SubAuthority[4] = nSubAuthority4; | 
|---|
| 135 | if (nSubAuthorityCount > 5) | 
|---|
| 136 | (*pSid)->SubAuthority[5] = nSubAuthority5; | 
|---|
| 137 | if (nSubAuthorityCount > 6) | 
|---|
| 138 | (*pSid)->SubAuthority[6] = nSubAuthority6; | 
|---|
| 139 | if (nSubAuthorityCount > 7) | 
|---|
| 140 | (*pSid)->SubAuthority[7] = nSubAuthority7; | 
|---|
| 141 |  | 
|---|
| 142 | if(pIdentifierAuthority) | 
|---|
| 143 | memcpy((PVOID)&(*pSid)->IdentifierAuthority, (PVOID)pIdentifierAuthority, sizeof(SID_IDENTIFIER_AUTHORITY)); | 
|---|
| 144 | return TRUE; | 
|---|
| 145 | } | 
|---|