473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Services and Vista

Hello group,

I wrote a Windows-Service using C#. This services creates a NamedPipe which will be used from somes Client-programs. This clients can and can not have Adminstrator rights. At the moment work ONLY when the clients are started having admin-rights. What should I do to allow connections from clients with different right levels?

Thanks in advance.

KW
Dec 6 '07 #1
4 1493
McKool,

How are you creating the named pipe?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"McKool" <ke*****@peak-system.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Hello group,

I wrote a Windows-Service using C#. This services creates a NamedPipe which
will be used from somes Client-programs. This clients can and can not have
Adminstrator rights. At the moment work ONLY when the clients are started
having admin-rights. What should I do to allow connections from clients with
different right levels?

Thanks in advance.

KW
Dec 6 '07 #2
like this:

hPipe = PipeIOApi.CreateNamedPipe(
"\\\\.\\pipe\\KWSPipe",
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
1024,
1024,
500,
IntPtr.Zero);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern SafeFileHandle CreateNamedPipe(
string name,
uint openMode,
uint pipeMode,
uint maxInstances,
uint outputBufferSize,
uint inputBufferSize,
uint defaultTimeOut,
IntPtr securityDescriptor);
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comschrieb im Newsbeitrag news:uM****************@TK2MSFTNGP06.phx.gbl...
McKool,

How are you creating the named pipe?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"McKool" <ke*****@peak-system.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Hello group,

I wrote a Windows-Service using C#. This services creates a NamedPipe which
will be used from somes Client-programs. This clients can and can not have
Adminstrator rights. At the moment work ONLY when the clients are started
having admin-rights. What should I do to allow connections from clients with
different right levels?

Thanks in advance.

KW

Dec 7 '07 #3

"McKool" <ke*****@peak-system.comwrote in message news:e0**************@TK2MSFTNGP04.phx.gbl...
like this:

hPipe = PipeIOApi.CreateNamedPipe(
"\\\\.\\pipe\\KWSPipe",
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
1024,
1024,
500,
IntPtr.Zero);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern SafeFileHandle CreateNamedPipe(
string name,
uint openMode,
uint pipeMode,
uint maxInstances,
uint outputBufferSize,
uint inputBufferSize,
uint defaultTimeOut,
IntPtr securityDescriptor);
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comschrieb im Newsbeitrag news:uM****************@TK2MSFTNGP06.phx.gbl...
McKool,

How are you creating the named pipe?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"McKool" <ke*****@peak-system.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Hello group,

I wrote a Windows-Service using C#. This services creates a NamedPipe which
will be used from somes Client-programs. This clients can and can not have
Adminstrator rights. At the moment work ONLY when the clients are started
having admin-rights. What should I do to allow connections from clients with
different right levels?

Thanks in advance.

KW

You are passing a null pointer as Security Descriptor, this will create a pipe that can only be accessed for reading and writing by "System" , "Administrators" and the "creator" accounts.
You need to pass a pointer to valid SECURITY_ATTRIBUTES structure, for instance here is how to create a NULL DACL.

struct SECURITY_ATTRIBUTES
{
public uint nLength;
public IntPtr lpSecurityDescriptor;
public int bInheritHandle;
};
change your CreateNamedPipe function signature as follows:
....
uint defaultTimeOut,
ref securityDescriptor)
and use it like:
SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
// init the sa with a null DACL, that is set all fields in sa to 0.
CreateNamedPipe(.........., ref sa);

Willy.
Dec 8 '07 #4
Hello Willy,

I tried that waht you wrote but without success. Nevertheless you gave me the Key... I found this article and, in this way, it's works:

http://codemortem.blogspot.com/2006/...ged-code..html

thanks a lot for your help.

KW.
"Willy Denoyette [MVP]" <wi*************@telenet.beschrieb im Newsbeitrag news:e1**************@TK2MSFTNGP02.phx.gbl...

"McKool" <ke*****@peak-system.comwrote in message news:e0**************@TK2MSFTNGP04.phx.gbl...
like this:

hPipe = PipeIOApi.CreateNamedPipe(
"\\\\.\\pipe\\KWSPipe",
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
1024,
1024,
500,
IntPtr.Zero);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern SafeFileHandle CreateNamedPipe(
string name,
uint openMode,
uint pipeMode,
uint maxInstances,
uint outputBufferSize,
uint inputBufferSize,
uint defaultTimeOut,
IntPtr securityDescriptor);
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comschrieb im Newsbeitrag news:uM****************@TK2MSFTNGP06.phx.gbl...
McKool,

How are you creating the named pipe?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"McKool" <ke*****@peak-system.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Hello group,

I wrote a Windows-Service using C#. This services creates a NamedPipe which
will be used from somes Client-programs. This clients can and can not have
Adminstrator rights. At the moment work ONLY when the clients are started
having admin-rights. What should I do to allow connections from clients with
different right levels?

Thanks in advance.

KW

You are passing a null pointer as Security Descriptor, this will create a pipe that can only be accessed for reading and writing by "System" , "Administrators" and the "creator" accounts.
You need to pass a pointer to valid SECURITY_ATTRIBUTES structure, for instance here is how to create a NULL DACL.

struct SECURITY_ATTRIBUTES
{
public uint nLength;
public IntPtr lpSecurityDescriptor;
public int bInheritHandle;
};
change your CreateNamedPipe function signature as follows:
...
uint defaultTimeOut,
ref securityDescriptor)
and use it like:
SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
// init the sa with a null DACL, that is set all fields in sa to 0.
CreateNamedPipe(.........., ref sa);

Willy.
Dec 10 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rasheed | last post by:
We are in the inception phase of architecting a .NET based multi tier application. Due to the .NET technology advancements, we have decided to go with .NET 2.0 beta 2 for development. One of the...
1
by: Kirk Allen Evans | last post by:
I wanted to let you know about a fantastic webcast series focusing on web services technologies. From ASMX 2.0 to WSE 3.0 to WCF, there are some great sessions that you will want to check out. ...
4
by: Water Cooler v2 | last post by:
I want to run a service at the background but also provide some user interface for editing some configuration options. In this regard, my questions are: 1. Can a Windows Service have a UI along...
6
by: Simon Harvey | last post by:
Hi everyone, We have a need to make a Windows Forms (2.0) client application that will be installed on our clients site. The data that the application uses needs to be centrally available to a...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Following the samples online, we implemented a windows service in .Net. Like most services, there's a worker thread actually doing stuff in the background. The problem we've run into is...
25
by: jim | last post by:
I thought that I read somewhere that services don't (or can't) have forms. Is that true?
0
balabaster
by: balabaster | last post by:
Hi, I know this question has been answered before (somewhat) but I have a twist... I've written a client/server application where the server portion runs as a windows service and allows...
2
by: christery | last post by:
Jippie, got my first c# service working with XP/W2003srv (love google), but got an hunch that vista will not support services that uses GUI (can interact with desktop... checkbox in services...
0
by: rblythe | last post by:
I am using Vista, IIS 7.0 and VS 2005 - I can create a C# web services app, record it in IIS as a virtual site and view its methods via IIS OK. However when I try to 'Add Web Reference' to the C#...
2
by: golub.gene | last post by:
Hi folks I need to choose Vista version, hopefully the lowest one like home edition, to have IIS services for some sql server feature to be active. Do you know which of those version have it. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.