ReactOS  0.4.13-dev-73-gcfe54aa
ntdsapi.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Dmitry Timoshkov
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #include <stdarg.h>
20 
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winerror.h"
24 #include "winuser.h"
25 #include "ntdsapi.h"
26 #include "wine/debug.h"
27 #include "wine/unicode.h"
28 
30 
31 /*****************************************************
32  * DllMain
33  */
35 {
36  TRACE("(%p, %d, %p)\n", hinst, reason, reserved);
37 
38  switch(reason)
39  {
40  case DLL_WINE_PREATTACH:
41  return FALSE; /* prefer native version */
42 
43  case DLL_PROCESS_ATTACH:
45  break;
46  }
47  return TRUE;
48 }
49 
50 /***********************************************************************
51  * DsBindA (NTDSAPI.@)
52  */
53 DWORD WINAPI DsBindA(LPCSTR controller, LPCSTR domain, HANDLE *handle)
54  {
55  FIXME("(%s,%s, %p): stub!\n", debugstr_a(controller), debugstr_a(domain), handle);
57 }
58 
59 /***********************************************************************
60  * DsBindW (NTDSAPI.@)
61  */
63  {
64  FIXME("(%s,%s, %p): stub!\n", debugstr_w(controller), debugstr_w(domain), handle);
66 }
67 
68 /***********************************************************************
69  * DsMakeSpnW (NTDSAPI.@)
70  */
71 DWORD WINAPI DsMakeSpnW(LPCWSTR svc_class, LPCWSTR svc_name,
72  LPCWSTR inst_name, USHORT inst_port,
73  LPCWSTR ref, DWORD *spn_length, LPWSTR spn)
74 {
75  DWORD new_spn_length;
76  INT len;
77  LPWSTR p;
78 
79  TRACE("(%s,%s,%s,%d,%s,%p,%p)\n", debugstr_w(svc_class),
80  debugstr_w(svc_name), debugstr_w(inst_name), inst_port,
81  debugstr_w(ref), spn_length, spn);
82 
83  if (!svc_class || !svc_name)
85 
86  new_spn_length = strlenW(svc_class) + 1 /* for '/' */ + 1 /* for terminating '\0' */;
87  if (inst_name)
88  new_spn_length += strlenW(inst_name);
89  else
90  new_spn_length += strlenW(svc_name);
91  if (inst_port)
92  {
93  USHORT n = inst_port;
94  new_spn_length += 1 /* for ':' */;
95  do
96  {
97  n /= 10;
98  new_spn_length++;
99  } while (n != 0);
100  }
101  if (inst_name)
102  new_spn_length += 1 /* for '/' */ + strlenW(svc_name);
103 
104  if (*spn_length < new_spn_length)
105  {
106  *spn_length = new_spn_length;
107  return ERROR_BUFFER_OVERFLOW;
108  }
109  *spn_length = new_spn_length;
110 
111  p = spn;
112  len = strlenW(svc_class);
113  memcpy(p, svc_class, len * sizeof(WCHAR));
114  p += len;
115  *p = '/';
116  p++;
117  if (inst_name)
118  {
119  len = strlenW(inst_name);
120  memcpy(p, inst_name, len * sizeof(WCHAR));
121  p += len;
122  *p = '\0';
123  }
124  else
125  {
126  len = strlenW(svc_name);
127  memcpy(p, svc_name, len * sizeof(WCHAR));
128  p += len;
129  *p = '\0';
130  }
131 
132  if (inst_port)
133  {
134  static const WCHAR percentU[] = {'%','u',0};
135  *p = ':';
136  p++;
137  wsprintfW(p, percentU, inst_port);
138  p += strlenW(p);
139  }
140 
141  if (inst_name)
142  {
143  *p = '/';
144  p++;
145  len = strlenW(svc_name);
146  memcpy(p, svc_name, len * sizeof(WCHAR));
147  p += len;
148  *p = '\0';
149  }
150 
151  TRACE("spn = %s\n", debugstr_w(spn));
152 
153  return ERROR_SUCCESS;
154 }
155 
156 /***********************************************************************
157  * DsMakeSpnA (NTDSAPI.@)
158  *
159  * See DsMakeSpnW.
160  */
161 DWORD WINAPI DsMakeSpnA(LPCSTR svc_class, LPCSTR svc_name,
162  LPCSTR inst_name, USHORT inst_port,
163  LPCSTR ref, DWORD *spn_length, LPSTR spn)
164 {
165  FIXME("(%s,%s,%s,%d,%s,%p,%p): stub!\n", debugstr_a(svc_class),
166  debugstr_a(svc_name), debugstr_a(inst_name), inst_port,
167  debugstr_a(ref), spn_length, spn);
168 
170 }
171 
172 /***********************************************************************
173  * DsMakeSpnA (NTDSAPI.@)
174  */
175 DWORD WINAPI DsGetSpnA(DS_SPN_NAME_TYPE ServType, LPCSTR Servlass, LPCSTR ServName,
176  USHORT InstPort, USHORT nInstanceNames,
177  LPCSTR *pInstanceNames, const USHORT *pInstancePorts,
178  DWORD *pSpn, LPSTR **pszSpn)
179 {
180  FIXME("(%d,%s,%s,%d,%d,%p,%p,%p,%p): stub!\n", ServType,
181  debugstr_a(Servlass), debugstr_a(ServName), InstPort,
182  nInstanceNames, pInstanceNames, pInstancePorts, pSpn, pszSpn);
183 
185 }
186 
187 /***********************************************************************
188  * DsServerRegisterSpnA (NTDSAPI.@)
189  */
190 DWORD WINAPI DsServerRegisterSpnA(DS_SPN_WRITE_OP operation, LPCSTR ServiceClass, LPCSTR UserObjectDN)
191 {
192  FIXME("(%d,%s,%s): stub!\n", operation,
193  debugstr_a(ServiceClass), debugstr_a(UserObjectDN));
195 }
196 
197 /***********************************************************************
198  * DsServerRegisterSpnW (NTDSAPI.@)
199  */
200 DWORD WINAPI DsServerRegisterSpnW(DS_SPN_WRITE_OP operation, LPCWSTR ServiceClass, LPCWSTR UserObjectDN)
201 {
202  FIXME("(%d,%s,%s): stub!\n", operation,
203  debugstr_w(ServiceClass), debugstr_w(UserObjectDN));
205 }
206 
207 /***********************************************************************
208  * DsClientMakeSpnForTargetServerW (NTDSAPI.@)
209  */
211 {
212  DWORD len;
213  WCHAR *p;
214 
215  TRACE("(%s,%s,%p,%p)\n", debugstr_w(class), debugstr_w(name), buflen, buf);
216 
217  if (!class || !name || !buflen) return ERROR_INVALID_PARAMETER;
218 
219  len = strlenW(class) + 1 + strlenW(name) + 1;
220  if (*buflen < len)
221  {
222  *buflen = len;
223  return ERROR_BUFFER_OVERFLOW;
224  }
225  *buflen = len;
226 
227  memcpy(buf, class, strlenW(class) * sizeof(WCHAR));
228  p = buf + strlenW(class);
229  *p++ = '/';
230  memcpy(p, name, strlenW(name) * sizeof(WCHAR));
231  buf[len - 1] = 0;
232 
233  return ERROR_SUCCESS;
234 }
235 
236 /***********************************************************************
237  * DsCrackNamesA (NTDSAPI.@)
238  */
241 {
242  FIXME("(%p %u %u %u %u %p %p stub\n", handle, flags, offered, desired, num, names, result);
244 }
245 
246 /***********************************************************************
247  * DsCrackNamesW (NTDSAPI.@)
248  */
251 {
252  FIXME("(%p %u %u %u %u %p %p stub\n", handle, flags, offered, desired, num, names, result);
254 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD WINAPI DsGetSpnA(DS_SPN_NAME_TYPE ServType, LPCSTR Servlass, LPCSTR ServName, USHORT InstPort, USHORT nInstanceNames, LPCSTR *pInstanceNames, const USHORT *pInstancePorts, DWORD *pSpn, LPSTR **pszSpn)
Definition: ntdsapi.c:175
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
DWORD WINAPI DsMakeSpnA(LPCSTR svc_class, LPCSTR svc_name, LPCSTR inst_name, USHORT inst_port, LPCSTR ref, DWORD *spn_length, LPSTR spn)
Definition: ntdsapi.c:161
char CHAR
Definition: xmlstorage.h:175
int desired
Definition: jpeglib.h:1116
GLdouble n
Definition: glext.h:7729
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
Definition: send.c:47
DWORD WINAPI DsBindW(LPCWSTR controller, LPCWSTR domain, HANDLE *handle)
Definition: ntdsapi.c:62
GLuint GLuint * names
Definition: glext.h:11545
DWORD WINAPI DsClientMakeSpnForTargetServerW(LPCWSTR class, LPCWSTR name, DWORD *buflen, LPWSTR buf)
Definition: ntdsapi.c:210
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2655
DS_SPN_WRITE_OP
Definition: ntdsapi.h:70
DWORD WINAPI DsBindA(LPCSTR controller, LPCSTR domain, HANDLE *handle)
Definition: ntdsapi.c:53
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD WINAPI DsCrackNamesA(HANDLE handle, DS_NAME_FLAGS flags, DS_NAME_FORMAT offered, DS_NAME_FORMAT desired, DWORD num, const CHAR **names, PDS_NAME_RESULTA *result)
Definition: ntdsapi.c:239
#define TRACE(s)
Definition: solgame.cpp:4
DS_NAME_FLAGS
Definition: ntdsapi.h:36
DWORD WINAPI DsServerRegisterSpnA(DS_SPN_WRITE_OP operation, LPCSTR ServiceClass, LPCSTR UserObjectDN)
Definition: ntdsapi.c:190
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
DS_SPN_NAME_TYPE
Definition: ntdsapi.h:60
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
DWORD WINAPI DsCrackNamesW(HANDLE handle, DS_NAME_FLAGS flags, DS_NAME_FORMAT offered, DS_NAME_FORMAT desired, DWORD num, const WCHAR **names, PDS_NAME_RESULTW *result)
Definition: ntdsapi.c:249
GLbitfield flags
Definition: glext.h:7161
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
DS_NAME_FORMAT
Definition: ntdsapi.h:45
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
DWORD WINAPI DsServerRegisterSpnW(DS_SPN_WRITE_OP operation, LPCWSTR ServiceClass, LPCWSTR UserObjectDN)
Definition: ntdsapi.c:200
unsigned short USHORT
Definition: pedump.c:61
WINE_DEFAULT_DEBUG_CHANNEL(ntdsapi)
DWORD WINAPI DsMakeSpnW(LPCWSTR svc_class, LPCWSTR svc_name, LPCWSTR inst_name, USHORT inst_port, LPCWSTR ref, DWORD *spn_length, LPWSTR spn)
Definition: ntdsapi.c:71
Definition: name.c:36
static HINSTANCE hinst
Definition: edit.c:551
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
Definition: ntdsapi.c:34
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
GLuint64EXT * result
Definition: glext.h:11304