ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ntdsapi.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Dmitry Timoshkov
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #include <stdarg.h>
00020 
00021 #include "windef.h"
00022 #include "winbase.h"
00023 #include "winerror.h"
00024 #include "winuser.h"
00025 #include "ntdsapi.h"
00026 #include "wine/debug.h"
00027 #include "wine/unicode.h"
00028 
00029 WINE_DEFAULT_DEBUG_CHANNEL(ntdsapi);
00030 
00031 /*****************************************************
00032  *      DllMain
00033  */
00034 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
00035 {
00036     TRACE("(%p, %d, %p)\n", hinst, reason, reserved);
00037 
00038     switch(reason)
00039     {
00040     case DLL_WINE_PREATTACH:
00041         return FALSE;  /* prefer native version */
00042 
00043     case DLL_PROCESS_ATTACH:
00044         DisableThreadLibraryCalls( hinst );
00045         break;
00046     }
00047     return TRUE;
00048 }
00049 
00050 /***********************************************************************
00051  *             DsMakeSpnW (NTDSAPI.@)
00052  */
00053 DWORD WINAPI DsMakeSpnW(LPCWSTR svc_class, LPCWSTR svc_name,
00054                         LPCWSTR inst_name, USHORT inst_port,
00055                         LPCWSTR ref, DWORD *spn_length, LPWSTR spn)
00056 {
00057     DWORD new_spn_length;
00058     INT len;
00059     LPWSTR p;
00060 
00061     TRACE("(%s,%s,%s,%d,%s,%p,%p)\n", debugstr_w(svc_class),
00062             debugstr_w(svc_name), debugstr_w(inst_name), inst_port,
00063             debugstr_w(ref), spn_length, spn);
00064 
00065     if (!svc_class || !svc_name)
00066         return ERROR_INVALID_PARAMETER;
00067 
00068     new_spn_length = strlenW(svc_class) + 1 /* for '/' */ + 1 /* for terminating '\0' */;
00069     if (inst_name)
00070         new_spn_length += strlenW(inst_name);
00071     else
00072         new_spn_length += strlenW(svc_name);
00073     if (inst_port)
00074     {
00075         USHORT n = inst_port;
00076         new_spn_length += 1 /* for ':' */;
00077         do
00078         {
00079             n /= 10;
00080             new_spn_length++;
00081         } while (n != 0);
00082     }
00083     if (inst_name)
00084         new_spn_length += 1 /* for '/' */ + strlenW(svc_name);
00085 
00086     if (*spn_length < new_spn_length)
00087     {
00088         *spn_length = new_spn_length;
00089         return ERROR_BUFFER_OVERFLOW;
00090     }
00091     *spn_length = new_spn_length;
00092 
00093     p = spn;
00094     len = strlenW(svc_class);
00095     memcpy(p, svc_class, len * sizeof(WCHAR));
00096     p += len;
00097     *p = '/';
00098     p++;
00099     if (inst_name)
00100     {
00101         len = strlenW(inst_name);
00102         memcpy(p, inst_name, len * sizeof(WCHAR));
00103         p += len;
00104         *p = '\0';
00105     }
00106     else
00107     {
00108         len = strlenW(svc_name);
00109         memcpy(p, svc_name, len * sizeof(WCHAR));
00110         p += len;
00111         *p = '\0';
00112     }
00113 
00114     if (inst_port)
00115     {
00116         static const WCHAR percentU[] = {'%','u',0};
00117         *p = ':';
00118         p++;
00119         wsprintfW(p, percentU, inst_port);
00120         p += strlenW(p);
00121     }
00122 
00123     if (inst_name)
00124     {
00125         *p = '/';
00126         p++;
00127         len = strlenW(svc_name);
00128         memcpy(p, svc_name, len * sizeof(WCHAR));
00129         p += len;
00130         *p = '\0';
00131     }
00132 
00133     TRACE("spn = %s\n", debugstr_w(spn));
00134 
00135     return ERROR_SUCCESS;
00136 }
00137 
00138 /***********************************************************************
00139  *             DsMakeSpnA (NTDSAPI.@)
00140  *
00141  * See DsMakeSpnW.
00142  */
00143 DWORD WINAPI DsMakeSpnA(LPCSTR svc_class, LPCSTR svc_name,
00144                         LPCSTR inst_name, USHORT inst_port,
00145                         LPCSTR ref, DWORD *spn_length, LPSTR spn)
00146 {
00147     FIXME("(%s,%s,%s,%d,%s,%p,%p): stub!\n", debugstr_a(svc_class),
00148             debugstr_a(svc_name), debugstr_a(inst_name), inst_port,
00149             debugstr_a(ref), spn_length, spn);
00150 
00151     return ERROR_CALL_NOT_IMPLEMENTED;
00152 }
00153 
00154 /***********************************************************************
00155  *             DsMakeSpnA (NTDSAPI.@)
00156  */
00157 DWORD WINAPI DsGetSpnA(DS_SPN_NAME_TYPE ServType, LPCSTR Servlass, LPCSTR ServName,
00158                        USHORT InstPort, USHORT nInstanceNames,
00159                        LPCSTR *pInstanceNames, const USHORT *pInstancePorts,
00160                        DWORD *pSpn, LPSTR **pszSpn)
00161 {
00162     FIXME("(%d,%s,%s,%d,%d,%p,%p,%p,%p): stub!\n", ServType,
00163             debugstr_a(Servlass), debugstr_a(ServName), InstPort,
00164             nInstanceNames, pInstanceNames, pInstancePorts, pSpn, pszSpn);
00165 
00166     return ERROR_CALL_NOT_IMPLEMENTED;
00167 }
00168 
00169 /***********************************************************************
00170  *             DsServerRegisterSpnA (NTDSAPI.@)
00171  */
00172 DWORD WINAPI DsServerRegisterSpnA(DS_SPN_WRITE_OP operation, LPCSTR ServiceClass, LPCSTR UserObjectDN)
00173 {
00174     FIXME("(%d,%s,%s): stub!\n", operation,
00175             debugstr_a(ServiceClass), debugstr_a(UserObjectDN));
00176     return ERROR_CALL_NOT_IMPLEMENTED;
00177 }
00178 
00179 /***********************************************************************
00180  *             DsServerRegisterSpnW (NTDSAPI.@)
00181  */
00182 DWORD WINAPI DsServerRegisterSpnW(DS_SPN_WRITE_OP operation, LPCWSTR ServiceClass, LPCWSTR UserObjectDN)
00183 {
00184     FIXME("(%d,%s,%s): stub!\n", operation,
00185             debugstr_w(ServiceClass), debugstr_w(UserObjectDN));
00186     return ERROR_CALL_NOT_IMPLEMENTED;
00187 }

Generated on Sun May 27 2012 04:25:31 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.