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