2 * Copyright (C) 2006 Dmitry Timoshkov
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.
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.
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
26 #include "wine/debug.h"
27 #include "wine/unicode.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(ntdsapi
);
31 /*****************************************************
34 BOOL WINAPI
DllMain(HINSTANCE hinst
, DWORD reason
, LPVOID reserved
)
36 TRACE("(%p, %d, %p)\n", hinst
, reason
, reserved
);
40 case DLL_WINE_PREATTACH
:
41 return FALSE
; /* prefer native version */
43 case DLL_PROCESS_ATTACH
:
44 DisableThreadLibraryCalls( hinst
);
50 /***********************************************************************
53 DWORD WINAPI
DsBindA(LPCSTR controller
, LPCSTR domain
, HANDLE
*handle
)
55 FIXME("(%s,%s, %p): stub!\n", debugstr_a(controller
), debugstr_a(domain
), handle
);
56 return ERROR_CALL_NOT_IMPLEMENTED
;
59 /***********************************************************************
62 DWORD WINAPI
DsBindW(LPCWSTR controller
, LPCWSTR domain
, HANDLE
*handle
)
64 FIXME("(%s,%s, %p): stub!\n", debugstr_w(controller
), debugstr_w(domain
), handle
);
65 return ERROR_CALL_NOT_IMPLEMENTED
;
68 /***********************************************************************
69 * DsMakeSpnW (NTDSAPI.@)
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
)
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
);
83 if (!svc_class
|| !svc_name
)
84 return ERROR_INVALID_PARAMETER
;
86 new_spn_length
= strlenW(svc_class
) + 1 /* for '/' */ + 1 /* for terminating '\0' */;
88 new_spn_length
+= strlenW(inst_name
);
90 new_spn_length
+= strlenW(svc_name
);
94 new_spn_length
+= 1 /* for ':' */;
102 new_spn_length
+= 1 /* for '/' */ + strlenW(svc_name
);
104 if (*spn_length
< new_spn_length
)
106 *spn_length
= new_spn_length
;
107 return ERROR_BUFFER_OVERFLOW
;
109 *spn_length
= new_spn_length
;
112 len
= strlenW(svc_class
);
113 memcpy(p
, svc_class
, len
* sizeof(WCHAR
));
119 len
= strlenW(inst_name
);
120 memcpy(p
, inst_name
, len
* sizeof(WCHAR
));
126 len
= strlenW(svc_name
);
127 memcpy(p
, svc_name
, len
* sizeof(WCHAR
));
134 static const WCHAR percentU
[] = {'%','u',0};
137 wsprintfW(p
, percentU
, inst_port
);
145 len
= strlenW(svc_name
);
146 memcpy(p
, svc_name
, len
* sizeof(WCHAR
));
151 TRACE("spn = %s\n", debugstr_w(spn
));
153 return ERROR_SUCCESS
;
156 /***********************************************************************
157 * DsMakeSpnA (NTDSAPI.@)
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
)
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
);
169 return ERROR_CALL_NOT_IMPLEMENTED
;
172 /***********************************************************************
173 * DsMakeSpnA (NTDSAPI.@)
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
)
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
);
184 return ERROR_CALL_NOT_IMPLEMENTED
;
187 /***********************************************************************
188 * DsServerRegisterSpnA (NTDSAPI.@)
190 DWORD WINAPI
DsServerRegisterSpnA(DS_SPN_WRITE_OP operation
, LPCSTR ServiceClass
, LPCSTR UserObjectDN
)
192 FIXME("(%d,%s,%s): stub!\n", operation
,
193 debugstr_a(ServiceClass
), debugstr_a(UserObjectDN
));
194 return ERROR_CALL_NOT_IMPLEMENTED
;
197 /***********************************************************************
198 * DsServerRegisterSpnW (NTDSAPI.@)
200 DWORD WINAPI
DsServerRegisterSpnW(DS_SPN_WRITE_OP operation
, LPCWSTR ServiceClass
, LPCWSTR UserObjectDN
)
202 FIXME("(%d,%s,%s): stub!\n", operation
,
203 debugstr_w(ServiceClass
), debugstr_w(UserObjectDN
));
204 return ERROR_CALL_NOT_IMPLEMENTED
;
207 DWORD WINAPI
DsClientMakeSpnForTargetServerW(LPCWSTR
class, LPCWSTR name
, DWORD
*buflen
, LPWSTR buf
)
212 TRACE("(%s,%s,%p,%p)\n", debugstr_w(class), debugstr_w(name
), buflen
, buf
);
214 if (!class || !name
|| !buflen
) return ERROR_INVALID_PARAMETER
;
216 len
= strlenW(class) + 1 + strlenW(name
) + 1;
220 return ERROR_BUFFER_OVERFLOW
;
224 memcpy(buf
, class, strlenW(class) * sizeof(WCHAR
));
225 p
= buf
+ strlenW(class);
227 memcpy(p
, name
, strlenW(name
) * sizeof(WCHAR
));
230 return ERROR_SUCCESS
;