Advertisement
TLama

Untitled

Jul 7th, 2015
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.12 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5. PrivilegesRequired=lowest
  6.  
  7. [Code]
  8. #ifdef UNICODE
  9.   #define AW "W"
  10. #else
  11.   #define AW "A"
  12. #endif
  13.  
  14. const
  15.   PIPE_TYPE_BYTE = $00000000;
  16.   PIPE_ACCESS_INBOUND = $00000001;
  17.   INVALID_HANDLE_VALUE = $FFFFFFFF;
  18.  
  19. type
  20.   LPSECURITY_ATTRIBUTES = Cardinal;
  21.  
  22. function CreateNamedPipe(lpName: string; dwOpenMode: DWORD; dwPipeMode: DWORD;
  23.   nMaxInstances: DWORD; nOutBufferSize: DWORD; nInBufferSize: DWORD;
  24.   nDefaultTimeOut: DWORD; lpSecurityAttributes: LPSECURITY_ATTRIBUTES): THandle;
  25.   external 'CreateNamedPipe{#AW}@kernel32.dll stdcall';
  26.  
  27. function CloseHandle(hObject: THandle): BOOL;
  28.   external 'CloseHandle@kernel32.dll stdcall';
  29.  
  30. procedure InitializeWizard;
  31. var
  32.   PipeHandle: THandle;
  33. begin
  34.   PipeHandle := CreateNamedPipe('\\.\pipe\SetupMsPipe123', PIPE_ACCESS_INBOUND, PIPE_TYPE_BYTE, 2, 0, 1024, 60000, 0);
  35.   if PipeHandle <> INVALID_HANDLE_VALUE then
  36.   begin
  37.     MsgBox('Pipe has been created!', mbInformation, MB_OK);
  38.     CloseHandle(PipeHandle);
  39.   end
  40.   else
  41.     MsgBox(SysErrorMessage(DLLGetLastError), mbError, mb_Ok);
  42. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement