Hi,
I am calling an exe from a webservice
I was using CreateProcessWithLogon() but it doesn't seem to work (MSDN
says it is supported) I get ERROR_ACCESS_DENIED.
It works fine if I am using an XP
Are there permissions that must be set in Win2K to allow this function
to work?
I tried swapping to using LogonUser() and CreateProcessAsUser() but
again they work fine and XP and fail on Win2K
this time the error is ERROR_PRIVILEGE_NOT_HELD
The MSDN says that the user calling LogonUser() needs SE_TCB_NAME
privilege.
I tried setting this and failed (on both OS this time)
The code I am using is in VB.Net below.
Can anyone tell me what I am doing wrong?
Or is there a way to set this without coding i.e. User settings
somewhere?
Vin
private declare Auto Function OpenProcessToken lib "advapi32.dll"
(ByVal ProcessHandle as IntPtr, ByVal DesiredAccess as Integer, ByRef
TokenHandle as IntPtr) as Boolean
private Declare auto Function LookupPrivilegeValue Lib "advapi32.dll"
(lpSystemName As String, lpName As String, ByRef lpLuid As LUID) As
Boolean
private Declare Function AdjustTokenPrivileges Lib "advapi32.dll"
(ByVal TokenHandle As IntPtr, ByVal DisableAllPrivileges As Boolean,
ByRef NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Integer,
ByVal PreviousState As IntPtr, ByVal ReturnLength As IntPtr) As
Boolean
Private Structure TOKEN_PRIVILEGES
public PrivilegeCount as Integer
' have tried variations on this parameter but none of them make
' a difference any array variant won't marshal
public Privileges as LUID_AND_ATTRIBUTES
end Structure
private Structure LUID_AND_ATTRIBUTES
Public Luid As LUID
Public Attributes As Integer
End Structure
private Structure LUID
Public LowPart As Integer
Public HighPart As Integer
End Structure
' Inside the Function
Dim hProc As IntPtr
dim hToken As IntPtr
Dim luid_TCB As LUID
Dim tp As New TOKEN_PRIVILEGES
' get the current process's token
hProc = Process.GetCurrentProcess().Handle
hToken = IntPtr.Zero
If Not OpenProcessToken(hProc, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY,
hToken) Then
throw new Exception(err.LastDllError)
End If
' get the LUID for the TCB privilege (provided it already exist)
luid_TCB.HighPart = 0
luid_TCB.lowPart = 0
If Not LookupPrivilegeValue(Nothing, SE_TCB_NAME, luid_TCB) Then
throw new Exception(err.LastDllError)
End If
tp.PrivilegeCount = 1
tp.Privileges.Luid = luid_TCB
tp.Privileges.Attributes = SE_PRIVILEGE_ENABLED
' enable the privileges
If Not AdjustTokenPrivileges(hToken, False, tp, 0, IntPtr.Zero,
IntPtr.Zero) Then
throw new Exception(err.LastDllError)
End If
dim errorCode as Integer
errorCode = err.LastDllError
' This will equal ERROR_NOT_ALL_ASSIGNED 4 2939
On Tue, 22 Jun 2004 17:24:22 +0100, Vincent Finn <1@2.com> wrote: I tried swapping to using LogonUser() and CreateProcessAsUser() but again they work fine and XP and fail on Win2K this time the error is ERROR_PRIVILEGE_NOT_HELD
I found teh setting for this in the Local Security Settings
and that gets LogonUser() to work but CreateProcessAsUser() gives the
privilege not held error now
Vin
can you wrote how you solved the problem
Thanks
p.s i've got the same problem also
"Vincent Finn" wrote: On Tue, 22 Jun 2004 17:24:22 +0100, Vincent Finn <1@2.com> wrote:
I tried swapping to using LogonUser() and CreateProcessAsUser() but again they work fine and XP and fail on Win2K this time the error is ERROR_PRIVILEGE_NOT_HELD
I found teh setting for this in the Local Security Settings and that gets LogonUser() to work but CreateProcessAsUser() gives the privilege not held error now
Vin
On Mon, 28 Jun 2004 03:24:02 -0700, "Gabi"
<Ga**@discussions.microsoft.com> wrote: can you wrote how you solved the problem Thanks
p.s i've got the same problem also
I haven't solved it.
I am still trying.
I have tried a variety of things and got nowhere so far.
I'll post a solution if I get one, looks like it'll be a nasty hack of
some sort though
Vin
On Mon, 28 Jun 2004 03:24:02 -0700, "Gabi"
<Ga**@discussions.microsoft.com> wrote: can you wrote how you solved the problem Thanks
p.s i've got the same problem also
I have solved the problem now and it is messy
I had to write a windows service.
This runs under the system account
I call this using a COM function and it then calls
CreateProcessWithLogon
everything works fine on 2000 and XP with this method.
(I am having trouble with 2003 instead but that may something
completely different)
Vin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael J. Wendell |
last post by:
Hello,
I am trying to debug an issue with sessions in my ASP 3.0 web
application, which runs fine on WIN2K Pro and WINXP Pro, yet fails to
function correctly on WIN2K Advanced Server.
My actual...
|
by: Matthew P. Seltzer |
last post by:
All-
This is a bit 'out there,' but, here goes. I have copied the WinSxS folder from a WinXP box to my Win2K box. I would like to be able to apply XP control styles to my Win2K VB.NET apps. Given...
|
by: Steven O. |
last post by:
I am considering installing the .Net IDE and Compiler on my Win2K
system. However, a friend tells me that since I have Win2K SP3, the
..Net installation software will, in essence, insist on first...
|
by: p175 |
last post by:
Hi folks,
I'm after some guidelines on general memory allocations for DB2 8.2.2
ESE on Win2k Server FP4 with 4gb physical memory.
Seeing as everything is 32bit and win2k server does not...
|
by: Alan Pong |
last post by:
access97, win98 or win2k adv. server sp2
I try compact the mdb file in above OSs. (sometimes i compact it in
win98 and sometimes i compact it in win2k)
The result surprises me, say in two...
|
by: bbxrider |
last post by:
win2k adv server/ iis5.0/vb6.0/ado and/or odbc connections on client machine
i have an mdb on win2k adv server machine and want internet read/write to it
from both a non-windows, red hat, webserver...
|
by: Paul |
last post by:
Hi all,
I have developed a system in Access 2000 (SP-3) for a client. The
system run's fine on NT 4 and Windows XP and most Win2k machines. I
say 'most' Win2k machines because there are a few...
|
by: alanknipmeyer |
last post by:
Hi,
I`m in the process of migrating a Access 2002 (Run in 2000 mode) from
Windows 98 to Win2K Server. It is a shared resource via a file share on
the 98 Server. Client systems are Win98 with the...
|
by: Alexander Stojakovic |
last post by:
Werte Kollegen!
I have a ASP.NET page authenticating via Integrated Security.
For some reason the behaviour on the client is differing depending
on the OS. I have some clients using WinXP and...
|
by: Adrian Parker |
last post by:
I have a web app that has one problem when deployed on win2003 but works
fine on win2k.
On a page, I have a button that causes a reload of the page with a different
set of querystring values (to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |