source: trunk/src/custombuild/guid.c@ 21494

Last change on this file since 21494 was 21494, checked in by dmik, 15 years ago

Fixed broken build after r21492 by sorting out a huuuuge wagon of duplicates, wrong include order and other dirty mess.

File size: 4.2 KB
Line 
1/* $Id: guid.c,v 1.4 2001-08-04 17:19:20 sandervl Exp $ */
2#include <odin.h>
3
4#define CINTERFACE
5#define INITGUID
6#include "wine/obj_base.h"
7
8#include "shlwapi.h"
9#include "shlguid.h"
10#include "shlobj.h"
11#include "docobj.h"
12#include "..\shell32\shellfolder.h"
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"
21#include "wine\obj_oleaut.h"
22#include "wine\obj_olefont.h"
23
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"
37
38#include <misc.h>
39
40/*********************************************************************
41 * CRTDLL__wcsnicmp (CRTDLL.321)
42 */
43int 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 }
51 return toupperW(*str1) - toupperW(*str2);
52}
53
54/*********************************************************************
55 * wcstombs (NTDLL.@)
56 */
57INT __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 */
70LONG __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 */
80INT __cdecl _wtoi(LPWSTR string)
81{
82 return _wtol(string);
83}
84
85/******************************************************************************
86 * RtlAllocateAndInitializeSid [NTDLL.265]
87 *
88 */
89BOOLEAN 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
140 if(pIdentifierAuthority)
141 memcpy((PVOID)&(*pSid)->IdentifierAuthority, (PVOID)pIdentifierAuthority, sizeof(SID_IDENTIFIER_AUTHORITY));
142 return TRUE;
143}
Note: See TracBrowser for help on using the repository browser.