comctl32/tests: Add NULL terminator to unicode string constant.
[wine/hramrach.git] / dlls / netapi32 / local_group.c
blobe125de5b9ff0770d9c21f874b3fd89bca6671887
1 /*
2 * Copyright 2006 Robert Reif
4 * netapi32 local group functions
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "lmcons.h"
29 #include "lmaccess.h"
30 #include "lmapibuf.h"
31 #include "lmerr.h"
32 #include "winreg.h"
33 #include "ntsecapi.h"
34 #include "wine/debug.h"
35 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
39 /************************************************************
40 * NetLocalGroupAdd (NETAPI32.@)
42 NET_API_STATUS WINAPI NetLocalGroupAdd(
43 LPCWSTR servername,
44 DWORD level,
45 LPBYTE buf,
46 LPDWORD parm_err)
48 FIXME("(%s %d %p %p) stub!\n", debugstr_w(servername), level, buf,
49 parm_err);
50 return NERR_Success;
53 /************************************************************
54 * NetLocalGroupAddMember (NETAPI32.@)
56 NET_API_STATUS WINAPI NetLocalGroupAddMember(
57 LPCWSTR servername,
58 LPCWSTR groupname,
59 PSID membersid)
61 FIXME("(%s %s %p) stub!\n", debugstr_w(servername),
62 debugstr_w(groupname), membersid);
63 return NERR_Success;
66 /************************************************************
67 * NetLocalGroupAddMembers (NETAPI32.@)
69 NET_API_STATUS WINAPI NetLocalGroupAddMembers(
70 LPCWSTR servername,
71 LPCWSTR groupname,
72 DWORD level,
73 LPBYTE buf,
74 DWORD totalentries)
76 FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
77 debugstr_w(groupname), level, buf, totalentries);
78 return NERR_Success;
81 /************************************************************
82 * NetLocalGroupDel (NETAPI32.@)
84 NET_API_STATUS WINAPI NetLocalGroupDel(
85 LPCWSTR servername,
86 LPCWSTR groupname)
88 FIXME("(%s %s) stub!\n", debugstr_w(servername), debugstr_w(groupname));
89 return NERR_Success;
92 /************************************************************
93 * NetLocalGroupDelMember (NETAPI32.@)
95 NET_API_STATUS WINAPI NetLocalGroupDelMember(
96 LPCWSTR servername,
97 LPCWSTR groupname,
98 PSID membersid)
100 FIXME("(%s %s %p) stub!\n", debugstr_w(servername),
101 debugstr_w(groupname), membersid);
102 return NERR_Success;
105 /************************************************************
106 * NetLocalGroupDelMembers (NETAPI32.@)
108 NET_API_STATUS WINAPI NetLocalGroupDelMembers(
109 LPCWSTR servername,
110 LPCWSTR groupname,
111 DWORD level,
112 LPBYTE buf,
113 DWORD totalentries)
115 FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
116 debugstr_w(groupname), level, buf, totalentries);
117 return NERR_Success;
120 /************************************************************
121 * NetLocalGroupEnum (NETAPI32.@)
123 NET_API_STATUS WINAPI NetLocalGroupEnum(
124 LPCWSTR servername,
125 DWORD level,
126 LPBYTE* bufptr,
127 DWORD prefmaxlen,
128 LPDWORD entriesread,
129 LPDWORD totalentries,
130 PDWORD_PTR resumehandle)
132 FIXME("(%s %d %p %d %p %p %p) stub!\n", debugstr_w(servername),
133 level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle);
134 *entriesread = 0;
135 *totalentries = 0;
136 return NERR_Success;
139 /************************************************************
140 * NetLocalGroupGetInfo (NETAPI32.@)
142 NET_API_STATUS WINAPI NetLocalGroupGetInfo(
143 LPCWSTR servername,
144 LPCWSTR groupname,
145 DWORD level,
146 LPBYTE* bufptr)
148 FIXME("(%s %s %d %p) stub!\n", debugstr_w(servername),
149 debugstr_w(groupname), level, bufptr);
150 return NERR_Success;
153 /************************************************************
154 * NetLocalGroupGetMembers (NETAPI32.@)
156 NET_API_STATUS WINAPI NetLocalGroupGetMembers(
157 LPCWSTR servername,
158 LPCWSTR localgroupname,
159 DWORD level,
160 LPBYTE* bufptr,
161 DWORD prefmaxlen,
162 LPDWORD entriesread,
163 LPDWORD totalentries,
164 PDWORD_PTR resumehandle)
166 FIXME("(%s %s %d %p %d, %p %p %p) stub!\n", debugstr_w(servername),
167 debugstr_w(localgroupname), level, bufptr, prefmaxlen, entriesread,
168 totalentries, resumehandle);
170 if (level == 3)
172 WCHAR userName[MAX_COMPUTERNAME_LENGTH + 1];
173 DWORD userNameLen;
174 DWORD len,needlen;
175 PLOCALGROUP_MEMBERS_INFO_3 ptr;
177 /* still a stub, current user is belonging to all groups */
179 *totalentries = 1;
180 *entriesread = 0;
182 userNameLen = MAX_COMPUTERNAME_LENGTH + 1;
183 GetUserNameW(userName,&userNameLen);
184 needlen = sizeof(LOCALGROUP_MEMBERS_INFO_3) +
185 (userNameLen+2) * sizeof(WCHAR);
186 if (prefmaxlen != MAX_PREFERRED_LENGTH)
187 len = min(prefmaxlen,needlen);
188 else
189 len = needlen;
191 NetApiBufferAllocate(len, (LPVOID *) bufptr);
192 if (len < needlen)
193 return ERROR_MORE_DATA;
195 ptr = (PLOCALGROUP_MEMBERS_INFO_3)*bufptr;
196 ptr->lgrmi3_domainandname = (LPWSTR)(*bufptr+sizeof(LOCALGROUP_MEMBERS_INFO_3));
197 lstrcpyW(ptr->lgrmi3_domainandname,userName);
199 *entriesread = 1;
202 return NERR_Success;
205 /************************************************************
206 * NetLocalGroupSetInfo (NETAPI32.@)
208 NET_API_STATUS WINAPI NetLocalGroupSetInfo(
209 LPCWSTR servername,
210 LPCWSTR groupname,
211 DWORD level,
212 LPBYTE buf,
213 LPDWORD parm_err)
215 FIXME("(%s %s %d %p %p) stub!\n", debugstr_w(servername),
216 debugstr_w(groupname), level, buf, parm_err);
217 return NERR_Success;
220 /************************************************************
221 * NetLocalGroupSetMember (NETAPI32.@)
223 NET_API_STATUS WINAPI NetLocalGroupSetMembers(
224 LPCWSTR servername,
225 LPCWSTR groupname,
226 DWORD level,
227 LPBYTE buf,
228 DWORD totalentries)
230 FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
231 debugstr_w(groupname), level, buf, totalentries);
232 return NERR_Success;