Autor Beitrag
woully
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Di 11.08.09 11:14 
Hi,

habe erneut ein Problem.

Ich habe einen Server und ein Client die über named pipes kommunizieren. Das ganze funktionniert wunderbar bei abgeschalteter UAC. Sobald die UAC eingeschaltet ist, gibt mit die Funktion ein INVALID_HANDLE_VALUE zurück..

Muss ich irgendwie meine Security Attributes anderst setzen ?

Hier mein Quell code :
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
Function TMPipe.CreateServer : boolean;
var 
   FSA : SECURITY_ATTRIBUTES; 
   FSD : SECURITY_DESCRIPTOR; 
begin
   Result := False;
   InitializeSecurityDescriptor(@FSD, SECURITY_DESCRIPTOR_REVISION);
   SetSecurityDescriptorDacl(@FSD, True, nil, False); 
   FSA.lpSecurityDescriptor := @FSD; 
   FSA.nLength := sizeof(SECURITY_ATTRIBUTES);
   FSA.bInheritHandle := True;

   FPipeServerHandle := CreateFile(fpipeName, GENERIC_WRITE, 0, @FSA,
                                   OPEN_EXISTING, 00);

                                                                                 ----> hier ist FPipeServerHandle = INVALID

  if FPipeServerHandle = INVALID_HANDLE_VALUE then
    raise EOSError.Create(Format(cERROPENPIPE, [fpipeName]));
  Result := True;
end;


Function TMPipe.CreateClient : boolean;
var 
  FSA: SECURITY_ATTRIBUTES; 
  FSD: SECURITY_DESCRIPTOR; 
begin 
   InitializeSecurityDescriptor(@FSD, SECURITY_DESCRIPTOR_REVISION); 
   SetSecurityDescriptorDacl(@FSD, True, nil, False); 
   FSA.lpSecurityDescriptor := @FSD; 
   FSA.nLength := sizeof(SECURITY_ATTRIBUTES); 
   FSA.bInheritHandle := True; 

   FPipeClientHandle := CreateNamedPipe(fpipeName, PIPE_ACCESS_INBOUND,
                               PIPE_TYPE_BYTE, PIPE_UNLIMITED_INSTANCES , 1024102450, @FSA);

  if FPipeClientHandle = INVALID_HANDLE_VALUE then
    raise EOSError.Create(Format(cERROPENPIPE, [fpipeName]));

  Result := True;
end;


Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt