Einzelnen Beitrag anzeigen

JonnyGuitar

Registriert seit: 4. Jun 2004
233 Beiträge
 
#8

Re: Kommunikation Service und Anwendung unter Vista

  Alt 19. Jun 2007, 11:09
servus,

ich habe jetzt in der unit mutexipc nach
Delphi-Quellcode:
If FMMFHandle = INVALID_HANDLE_VALUE Then
Begin
  FMMFHandle := CreateFileMapping($FFFFFFFF, @aSa, PAGE_READWRITE, 0, MutexSize, PChar('MIPC_' + MutexName + '_MMF'));
  If FMMFHandle = 0 Then
    Raise EMIPCInitialization.Create('Error creating file mapping object.');
  Precreated := GetLastError = ERROR_ALREADY_EXISTS;
End
Else
 Precreated := True;
folgendes eingefügt:
Delphi-Quellcode:
if not DuplicateHandle(GetCurrentProcess, FMMFHandle,GetCurrentProcess, @FMMFHandle, 0, FALSE, DUPLICATE_SAME_ACCESS) then
  RaiseLastWin32Error;
und nach
Delphi-Quellcode:
If (FMutexHandle = INVALID_HANDLE_VALUE) Or (FClientID = MIPC_USER_UNDEFINED) Or (FClientID = MIPC_USER_BROADCAST) Then
Begin
  CloseIPC;
  SetLastError(ERROR_ALREADY_EXISTS);
  If (FClientID = MIPC_USER_UNDEFINED) Or (FClientID = MIPC_USER_BROADCAST) Then
    FClientID := GenClientID;
  While GetLastError = ERROR_ALREADY_EXISTS Do
  Begin
    FMutexHandle := CreateMutex(Nil, True, PChar(Format('MIPC_%s_CLIENT%.8x', [MutexName, ClientID])));
    If GetLastError = ERROR_ALREADY_EXISTS Then
    Begin
      CloseHandle(FMutexHandle);
      FClientID := GenClientID;
    End;
  End;
folgendes
Delphi-Quellcode:
if not DuplicateHandle(GetCurrentProcess, FMutexHandle,GetCurrentProcess, @FMutexHandle, 0, FALSE, DUPLICATE_SAME_ACCESS) then
  RaiseLastWin32Error;
leider immer noch keine besserung, der service und die anwendung scheinen unterschiedliche speicherbereiche zu nutzen.

oder habe ich was bei duplicatehandle falsch gemacht?


mfg Jonny
the only thing to fear is runnin' out of beer
  Mit Zitat antworten Zitat