Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
dbcac928
Commit
dbcac928
authored
Jan 24, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Jan 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdsapi: Implement DsMakeSpnW.
parent
5db45041
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
15 deletions
+79
-15
Makefile.in
dlls/ntdsapi/Makefile.in
+1
-1
ntdsapi.c
dlls/ntdsapi/ntdsapi.c
+78
-2
ntdsapi.c
dlls/ntdsapi/tests/ntdsapi.c
+0
-12
No files found.
dlls/ntdsapi/Makefile.in
View file @
dbcac928
...
...
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
MODULE
=
ntdsapi.dll
IMPORTLIB
=
libntdsapi.
$(IMPLIBEXT)
IMPORTS
=
kernel32
IMPORTS
=
user32
kernel32
C_SRCS
=
\
ntdsapi.c
...
...
dlls/ntdsapi/ntdsapi.c
View file @
dbcac928
...
...
@@ -21,8 +21,10 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winuser.h"
#include "ntdsapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ntdsapi
);
...
...
@@ -52,11 +54,85 @@ DWORD WINAPI DsMakeSpnW(LPCWSTR svc_class, LPCWSTR svc_name,
LPCWSTR
inst_name
,
USHORT
inst_port
,
LPCWSTR
ref
,
DWORD
*
spn_length
,
LPWSTR
spn
)
{
FIXME
(
"(%s,%s,%s,%d,%s,%p,%p): stub!
\n
"
,
debugstr_w
(
svc_class
),
DWORD
new_spn_length
;
INT
len
;
LPWSTR
p
;
TRACE
(
"(%s,%s,%s,%d,%s,%p,%p)
\n
"
,
debugstr_w
(
svc_class
),
debugstr_w
(
svc_name
),
debugstr_w
(
inst_name
),
inst_port
,
debugstr_w
(
ref
),
spn_length
,
spn
);
return
ERROR_CALL_NOT_IMPLEMENTED
;
if
(
!
svc_class
||
!
svc_name
)
return
ERROR_INVALID_PARAMETER
;
new_spn_length
=
strlenW
(
svc_class
)
+
1
/* for '/' */
+
1
/* for terminating '\0' */
;
if
(
inst_name
)
new_spn_length
+=
strlenW
(
inst_name
);
else
new_spn_length
+=
strlenW
(
svc_name
);
if
(
inst_port
)
{
USHORT
n
=
inst_port
;
new_spn_length
+=
1
/* for ':' */
;
do
{
n
/=
10
;
new_spn_length
++
;
}
while
(
n
!=
0
);
}
if
(
inst_name
)
new_spn_length
+=
1
/* for '/' */
+
strlenW
(
svc_name
);
if
(
*
spn_length
<
new_spn_length
)
{
*
spn_length
=
new_spn_length
;
return
ERROR_BUFFER_OVERFLOW
;
}
*
spn_length
=
new_spn_length
;
p
=
spn
;
len
=
strlenW
(
svc_class
);
memcpy
(
p
,
svc_class
,
len
*
sizeof
(
WCHAR
));
p
+=
len
;
*
p
=
'/'
;
p
++
;
if
(
inst_name
)
{
len
=
strlenW
(
inst_name
);
memcpy
(
p
,
inst_name
,
len
*
sizeof
(
WCHAR
));
p
+=
len
;
*
p
=
'\0'
;
}
else
{
len
=
strlenW
(
svc_name
);
memcpy
(
p
,
svc_name
,
len
*
sizeof
(
WCHAR
));
p
+=
len
;
*
p
=
'\0'
;
}
if
(
inst_port
)
{
static
const
WCHAR
percentU
[]
=
{
'%'
,
'u'
,
0
};
*
p
=
':'
;
p
++
;
wsprintfW
(
p
,
percentU
,
inst_port
);
p
+=
strlenW
(
p
);
}
if
(
inst_name
)
{
*
p
=
'/'
;
p
++
;
len
=
strlenW
(
svc_name
);
memcpy
(
p
,
svc_name
,
len
*
sizeof
(
WCHAR
));
p
+=
len
;
*
p
=
'\0'
;
}
TRACE
(
"spn = %s
\n
"
,
debugstr_w
(
spn
));
return
ERROR_SUCCESS
;
}
DWORD
WINAPI
DsMakeSpnA
(
LPCSTR
svc_class
,
LPCSTR
svc_name
,
...
...
dlls/ntdsapi/tests/ntdsapi.c
View file @
dbcac928
...
...
@@ -54,53 +54,41 @@ static void test_DsMakeSpn(void)
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
NULL
,
NULL
,
NULL
,
0
,
NULL
,
&
spn_length
,
spn
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"DsMakeSpnW should have failed with ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
NULL
,
wszServiceHost
,
NULL
,
0
,
NULL
,
&
spn_length
,
spn
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"DsMakeSpnW should have failed with ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
wszServiceClass
,
wszServiceHost
,
NULL
,
0
,
NULL
,
&
spn_length
,
spn
);
todo_wine
{
ok
(
ret
==
ERROR_SUCCESS
,
"DsMakeSpnW should have succeeded instead of failing with %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
spn
,
wszSpn1
),
"DsMakeSpnW returned unexpected SPN %s
\n
"
,
wine_dbgstr_w
(
spn
));
ok
(
spn_length
==
lstrlenW
(
wszSpn1
)
+
1
,
"DsMakeSpnW should have returned spn_length of %d instead of %d
\n
"
,
lstrlenW
(
wszSpn1
)
+
1
,
spn_length
);
}
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
wszServiceClass
,
wszServiceHost
,
wszInstanceName
,
0
,
NULL
,
&
spn_length
,
spn
);
todo_wine
{
ok
(
ret
==
ERROR_SUCCESS
,
"DsMakeSpnW should have succeeded instead of failing with %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
spn
,
wszSpn2
),
"DsMakeSpnW returned unexpected SPN %s
\n
"
,
wine_dbgstr_w
(
spn
));
ok
(
spn_length
==
lstrlenW
(
wszSpn2
)
+
1
,
"DsMakeSpnW should have returned spn_length of %d instead of %d
\n
"
,
lstrlenW
(
wszSpn2
)
+
1
,
spn_length
);
}
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
wszServiceClass
,
wszServiceHost
,
wszInstanceName
,
555
,
NULL
,
&
spn_length
,
spn
);
todo_wine
{
ok
(
ret
==
ERROR_SUCCESS
,
"DsMakeSpnW should have succeeded instead of failing with %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
spn
,
wszSpn3
),
"DsMakeSpnW returned unexpected SPN %s
\n
"
,
wine_dbgstr_w
(
spn
));
ok
(
spn_length
==
lstrlenW
(
wszSpn3
)
+
1
,
"DsMakeSpnW should have returned spn_length of %d instead of %d
\n
"
,
lstrlenW
(
wszSpn3
)
+
1
,
spn_length
);
}
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
wszServiceClass
,
wszServiceHost
,
wszInstanceName
,
555
,
wszReferrer
,
&
spn_length
,
spn
);
todo_wine
{
ok
(
ret
==
ERROR_SUCCESS
,
"DsMakeSpnW should have succeeded instead of failing with %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
spn
,
wszSpn4
),
"DsMakeSpnW returned unexpected SPN %s
\n
"
,
wine_dbgstr_w
(
spn
));
ok
(
spn_length
==
lstrlenW
(
wszSpn4
)
+
1
,
"DsMakeSpnW should have returned spn_length of %d instead of %d
\n
"
,
lstrlenW
(
wszSpn4
)
+
1
,
spn_length
);
}
spn_length
=
sizeof
(
spn
)
/
sizeof
(
spn
[
0
]);
ret
=
DsMakeSpnW
(
wszServiceClass
,
wszServiceHost
,
NULL
,
555
,
wszReferrer
,
&
spn_length
,
spn
);
todo_wine
{
ok
(
ret
==
ERROR_SUCCESS
,
"DsMakeSpnW should have succeeded instead of failing with %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
spn
,
wszSpn5
),
"DsMakeSpnW returned unexpected SPN %s
\n
"
,
wine_dbgstr_w
(
spn
));
ok
(
spn_length
==
lstrlenW
(
wszSpn5
)
+
1
,
"DsMakeSpnW should have returned spn_length of %d instead of %d
\n
"
,
lstrlenW
(
wszSpn5
)
+
1
,
spn_length
);
}
}
START_TEST
(
ntdsapi
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment