Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
26f33e4d
Commit
26f33e4d
authored
26 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
LogonUser fixed
Rev: src/modules/system/nt.c:1.3
parent
59b9f6b7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/system/nt.c
+43
-18
43 additions, 18 deletions
src/modules/system/nt.c
with
43 additions
and
18 deletions
src/modules/system/nt.c
+
43
−
18
View file @
26f33e4d
/*
/*
* $Id: nt.c,v 1.
2
1998/0
7/27 21:57:46
hubbe Exp $
* $Id: nt.c,v 1.
3
1998/0
8/06 05:32:20
hubbe Exp $
*
*
* NT system calls for Pike
* NT system calls for Pike
*
*
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include
"stralloc.h"
#include
"stralloc.h"
#include
"las.h"
#include
"las.h"
#include
"threads.h"
#include
"threads.h"
#include
"module_support.h"
#include
<winsock.h>
#include
<winsock.h>
#include
<windows.h>
#include
<windows.h>
...
@@ -111,6 +112,11 @@ static struct program *token_program;
...
@@ -111,6 +112,11 @@ static struct program *token_program;
#define THIS_TOKEN (*(HANDLE *)(fp->current_storage))
#define THIS_TOKEN (*(HANDLE *)(fp->current_storage))
typedef
BOOL
WINAPI
(
*
logonusertype
)(
LPSTR
,
LPSTR
,
LPSTR
,
DWORD
,
DWORD
,
PHANDLE
);
static
logonusertype
logonuser
;
HINSTANCE
advapilib
;
void
f_LogonUser
(
INT32
args
)
void
f_LogonUser
(
INT32
args
)
{
{
LPTSTR
username
,
domain
,
pw
;
LPTSTR
username
,
domain
,
pw
;
...
@@ -145,7 +151,7 @@ void f_LogonUser(INT32 args)
...
@@ -145,7 +151,7 @@ void f_LogonUser(INT32 args)
}
}
THREADS_ALLOW
();
THREADS_ALLOW
();
ret
=
L
ogon
U
ser
(
username
,
domain
,
pw
,
logontype
,
logonprovider
,
&
x
);
ret
=
l
ogon
u
ser
(
username
,
domain
,
pw
,
logontype
,
logonprovider
,
&
x
);
THREADS_DISALLOW
();
THREADS_DISALLOW
();
if
(
ret
)
if
(
ret
)
{
{
...
@@ -174,14 +180,6 @@ static void exit_token(struct object *o)
...
@@ -174,14 +180,6 @@ static void exit_token(struct object *o)
void
init_nt_system_calls
(
void
)
void
init_nt_system_calls
(
void
)
{
{
start_new_program
();
add_storage
(
sizeof
(
HANDLE
));
set_init_callback
(
init_token
);
set_exit_callback
(
exit_token
);
token_program
=
end_program
();
add_program_constant
(
"UserToken"
,
token_program
,
0
);
token_program
->
flags
|=
PROGRAM_DESTRUCT_IMMEDIATE
;
add_function
(
"cp"
,
f_cp
,
"function(string,string:int)"
,
0
);
add_function
(
"cp"
,
f_cp
,
"function(string,string:int)"
,
0
);
#define ADD_GLOBAL_INTEGER_CONSTANT(X,Y) \
#define ADD_GLOBAL_INTEGER_CONSTANT(X,Y) \
push_int((long)(Y)); low_add_constant(X,sp-1); pop_stack();
push_int((long)(Y)); low_add_constant(X,sp-1); pop_stack();
...
@@ -192,6 +190,15 @@ void init_nt_system_calls(void)
...
@@ -192,6 +190,15 @@ void init_nt_system_calls(void)
ADD_GLOBAL_INTEGER_CONSTANT
(
"HKEY_CLASSES_ROOT"
,
HKEY_CLASSES_ROOT
);
ADD_GLOBAL_INTEGER_CONSTANT
(
"HKEY_CLASSES_ROOT"
,
HKEY_CLASSES_ROOT
);
add_efun
(
"RegGetValue"
,
f_RegGetValue
,
"function(int,string,string:string|int|string*)"
,
OPT_EXTERNAL_DEPEND
);
add_efun
(
"RegGetValue"
,
f_RegGetValue
,
"function(int,string,string:string|int|string*)"
,
OPT_EXTERNAL_DEPEND
);
/* LogonUser only exists on NT, link it dynamically */
if
(
advapilib
=
LoadLibrary
(
"advapi32"
))
{
FARPROC
proc
;
if
(
proc
=
GetProcAddress
(
advapilib
,
"LogonUserA"
))
{
logonuser
=
(
logonusertype
)
proc
;
add_function
(
"LogonUser"
,
f_LogonUser
,
"function(string,string,string,int|void,void|int:object)"
,
0
);
add_function
(
"LogonUser"
,
f_LogonUser
,
"function(string,string,string,int|void,void|int:object)"
,
0
);
#define SIMPCONST(X) \
#define SIMPCONST(X) \
add_integer_constant(#X,X,0);
add_integer_constant(#X,X,0);
...
@@ -201,6 +208,16 @@ void init_nt_system_calls(void)
...
@@ -201,6 +208,16 @@ void init_nt_system_calls(void)
SIMPCONST
(
LOGON32_LOGON_SERVICE
);
SIMPCONST
(
LOGON32_LOGON_SERVICE
);
SIMPCONST
(
LOGON32_LOGON_NETWORK
);
SIMPCONST
(
LOGON32_LOGON_NETWORK
);
SIMPCONST
(
LOGON32_PROVIDER_DEFAULT
);
SIMPCONST
(
LOGON32_PROVIDER_DEFAULT
);
start_new_program
();
add_storage
(
sizeof
(
HANDLE
));
set_init_callback
(
init_token
);
set_exit_callback
(
exit_token
);
token_program
=
end_program
();
add_program_constant
(
"UserToken"
,
token_program
,
0
);
token_program
->
flags
|=
PROGRAM_DESTRUCT_IMMEDIATE
;
}
}
}
}
void
exit_nt_system_calls
(
void
)
void
exit_nt_system_calls
(
void
)
...
@@ -210,6 +227,14 @@ void exit_nt_system_calls(void)
...
@@ -210,6 +227,14 @@ void exit_nt_system_calls(void)
free_program
(
token_program
);
free_program
(
token_program
);
token_program
=
0
;
token_program
=
0
;
}
}
if
(
advapilib
)
{
if
(
FreeLibrary
(
advapilib
))
{
advapilib
=
0
;
logonuser
=
0
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment