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 /***********************************************************************
51 * DsMakeSpnW (NTDSAPI.@)
53 DWORD WINAPI DsMakeSpnW(LPCWSTR svc_class, LPCWSTR svc_name,
54 LPCWSTR inst_name, USHORT inst_port,
55 LPCWSTR ref, DWORD *spn_length, LPWSTR spn)
61 TRACE("(%s,%s,%s,%d,%s,%p,%p)\n", debugstr_w(svc_class),
62 debugstr_w(svc_name), debugstr_w(inst_name), inst_port,
63 debugstr_w(ref), spn_length, spn);
65 if (!svc_class || !svc_name)
66 return ERROR_INVALID_PARAMETER;
68 new_spn_length = strlenW(svc_class) + 1 /* for '/' */ + 1 /* for terminating '\0' */;
70 new_spn_length += strlenW(inst_name);
72 new_spn_length += strlenW(svc_name);
76 new_spn_length += 1 /* for ':' */;
84 new_spn_length += 1 /* for '/' */ + strlenW(svc_name);
86 if (*spn_length < new_spn_length)
88 *spn_length = new_spn_length;
89 return ERROR_BUFFER_OVERFLOW;
91 *spn_length = new_spn_length;
94 len = strlenW(svc_class);
95 memcpy(p, svc_class, len * sizeof(WCHAR));
101 len = strlenW(inst_name);
102 memcpy(p, inst_name, len * sizeof(WCHAR));
108 len = strlenW(svc_name);
109 memcpy(p, svc_name, len * sizeof(WCHAR));
116 static const WCHAR percentU[] = {'%','u',0};
119 wsprintfW(p, percentU, inst_port);
127 len = strlenW(svc_name);
128 memcpy(p, svc_name, len * sizeof(WCHAR));
133 TRACE("spn = %s\n", debugstr_w(spn));
135 return ERROR_SUCCESS;
138 /***********************************************************************
139 * DsMakeSpnA (NTDSAPI.@)
143 DWORD WINAPI DsMakeSpnA(LPCSTR svc_class, LPCSTR svc_name,
144 LPCSTR inst_name, USHORT inst_port,
145 LPCSTR ref, DWORD *spn_length, LPSTR spn)
147 FIXME("(%s,%s,%s,%d,%s,%p,%p): stub!\n", debugstr_a(svc_class),
148 debugstr_a(svc_name), debugstr_a(inst_name), inst_port,
149 debugstr_a(ref), spn_length, spn);
151 return ERROR_CALL_NOT_IMPLEMENTED;