ReactOS  0.4.15-dev-3718-g2318f7f
msclient.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <windows.h>
5 #include <tchar.h>
6 
7 #define BUFSIZE 1024
8 #define MAILSLOT_TIMEOUT 1000
9 
10 
11 int main(int argc, char *argv[])
12 {
13  HANDLE hMailslot;
14  LPSTR lpszMailslotName = "\\\\.\\MAILSLOT\\mymailslot";
15  LPSTR lpszTestMessage = "Mailslot test message!";
16  DWORD cbLength, cbWritten;
17 
18  hMailslot = CreateFile(lpszMailslotName,
24  (HANDLE)NULL);
25  printf("hMailslot %x\n", (DWORD)hMailslot);
26  if (hMailslot == INVALID_HANDLE_VALUE)
27  {
28  printf("CreateFile() failed\n");
29  return 0;
30  }
31 
32  cbLength = (ULONG)strlen(lpszTestMessage)+1;
33 
34  WriteFile(hMailslot,
35  lpszTestMessage,
36  cbLength,
37  &cbWritten,
38  NULL);
39 
40  CloseHandle(hMailslot);
41 
42  return 0;
43 }
44 
45 /* EOF */
46 
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static int argc
Definition: ServiceArgs.c:12
#define CloseHandle
Definition: compat.h:598
int main(int argc, char *argv[])
Definition: msclient.c:11
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define argv
Definition: mplay32.c:18
char * LPSTR
Definition: xmlstorage.h:182
#define FILE_SHARE_READ
Definition: compat.h:136
#define GENERIC_WRITE
Definition: nt_native.h:90
#define OPEN_EXISTING
Definition: compat.h:634
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:913
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define printf
Definition: config.h:203