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
499eed08
Commit
499eed08
authored
Nov 20, 2013
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 20, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Add helpers to initialize and destroy a libnetapi context.
parent
7e729853
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
28 deletions
+40
-28
netapi32.c
dlls/netapi32/netapi32.c
+40
-28
No files found.
dlls/netapi32/netapi32.c
View file @
499eed08
...
...
@@ -85,10 +85,48 @@ static NET_API_STATUS (*pNetShareAdd)(const char *, unsigned int, unsigned char
static
NET_API_STATUS
(
*
pNetShareDel
)(
const
char
*
,
const
char
*
,
unsigned
int
);
static
NET_API_STATUS
(
*
pNetWkstaGetInfo
)(
const
char
*
,
unsigned
int
,
unsigned
char
**
);
static
void
destroy_context
(
void
)
{
TRACE
(
"destroying %p
\n
"
,
libnetapi_ctx
);
plibnetapi_free
(
libnetapi_ctx
);
libnetapi_ctx
=
NULL
;
}
static
BOOL
init_context
(
void
)
{
DWORD
status
;
if
((
status
=
plibnetapi_init
(
&
libnetapi_ctx
)))
{
ERR
(
"Failed to initialize context %u
\n
"
,
status
);
return
FALSE
;
}
if
(
TRACE_ON
(
netapi32
)
&&
(
status
=
plibnetapi_set_debuglevel
(
libnetapi_ctx
,
"10"
)))
{
ERR
(
"Failed to set debug level %u
\n
"
,
status
);
destroy_context
();
return
FALSE
;
}
/* perform an anonymous login by default (avoids a password prompt) */
if
((
status
=
plibnetapi_set_username
(
libnetapi_ctx
,
"Guest"
)))
{
ERR
(
"Failed to set username %u
\n
"
,
status
);
destroy_context
();
return
FALSE
;
}
if
((
status
=
plibnetapi_set_password
(
libnetapi_ctx
,
""
)))
{
ERR
(
"Failed to set password %u
\n
"
,
status
);
destroy_context
();
return
FALSE
;
}
TRACE
(
"using %p
\n
"
,
libnetapi_ctx
);
return
TRUE
;
}
static
BOOL
libnetapi_init
(
void
)
{
char
buf
[
200
];
DWORD
status
;
if
(
libnetapi_handle
)
return
TRUE
;
if
(
!
(
libnetapi_handle
=
wine_dlopen
(
SONAME_LIBNETAPI
,
RTLD_NOW
,
buf
,
sizeof
(
buf
)
)))
...
...
@@ -118,35 +156,9 @@ static BOOL libnetapi_init(void)
LOAD_FUNCPTR
(
NetWkstaGetInfo
)
#undef LOAD_FUNCPTR
if
((
status
=
plibnetapi_init
(
&
libnetapi_ctx
)))
{
ERR
(
"Failed to initialize context %u
\n
"
,
status
);
goto
error
;
}
if
(
TRACE_ON
(
netapi32
)
&&
(
status
=
plibnetapi_set_debuglevel
(
libnetapi_ctx
,
"10"
)))
{
ERR
(
"Failed to set debug level %u
\n
"
,
status
);
goto
error
;
}
/* perform an anonymous login by default (avoids a password prompt) */
if
((
status
=
plibnetapi_set_username
(
libnetapi_ctx
,
"Guest"
)))
{
ERR
(
"Failed to set username %u
\n
"
,
status
);
goto
error
;
}
if
((
status
=
plibnetapi_set_password
(
libnetapi_ctx
,
""
)))
{
ERR
(
"Failed to set password %u
\n
"
,
status
);
goto
error
;
}
return
TRUE
;
if
(
init_context
())
return
TRUE
;
error:
if
(
libnetapi_ctx
)
{
plibnetapi_free
(
libnetapi_ctx
);
libnetapi_ctx
=
NULL
;
}
wine_dlclose
(
libnetapi_handle
,
NULL
,
0
);
libnetapi_handle
=
NULL
;
return
FALSE
;
...
...
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