Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / January 2005

Tip: Looking for answers? Try searching our database.

Problem using WTSOpenServer on Win2003Server DC  

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christopher Attard - 07 Jan 2005 14:09 GMT
Hi,
       I'm using WTSOpenServer (P/Invoke in a C# application) to open a
handle to a specified terminal server which is Win2003 Server Domain
Controller.

       The function is returning NULL (or 0). I'm able to connect
successfully to the terminal server when using the remote desktop program
from a WinXP client machine.

       Any ideas or suggestions pls?

Regards,
Chris Attard
Mattias Sj?gren - 07 Jan 2005 14:46 GMT
>        Any ideas or suggestions pls?

Ensure that you have SetLastError=true in your DllImport attribute,
then call Marshal.GetLastWin32Error() after the call to
WTSOpenServer() to get an idea about why its failing.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Christopher Attard - 07 Jan 2005 14:55 GMT
Yes, I'm already dong it....The error returned is: 5

>>        Any ideas or suggestions pls?
>
[quoted text clipped - 3 lines]
>
> Mattias
Willy Denoyette [MVP] - 07 Jan 2005 17:30 GMT
Which means "access denied".
You have to impersonate using a privileged account's credentials (like a
domain admins, or enterprise admins account).

Willy.

> Yes, I'm already dong it....The error returned is: 5
>
[quoted text clipped - 5 lines]
>>
>> Mattias
Christopher Attard - 08 Jan 2005 09:47 GMT
I'm using the Administrator account which is a member of the Domain Admins
and still it's returning an error of 5. What seems awkward is that when I'm
using the same account to connect to the same server through mstsc.exe, its
creating a successful terminal session.

Chris

> Which means "access denied".
> You have to impersonate using a privileged account's credentials (like a
[quoted text clipped - 11 lines]
>>>
>>> Mattias
Willy Denoyette [MVP] - 08 Jan 2005 10:28 GMT
Should work, try using a DC administrator account.
- check the eventlog (turn on auditing).
- check your accounts privileges.

Willy.

> I'm using the Administrator account which is a member of the Domain Admins
> and still it's returning an error of 5. What seems awkward is that when
[quoted text clipped - 18 lines]
>>>>
>>>> Mattias
Christopher Attard - 10 Jan 2005 08:47 GMT
Thanks Willy...problem solved. Infact i was running the call in the security
context of a non-administrative account.

Chris

> Should work, try using a DC administrator account.
> - check the eventlog (turn on auditing).
[quoted text clipped - 24 lines]
>>>>>
>>>>> Mattias

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.