&dwMsgCount, &dwTimeout ), "getmailslotinfo succeeded\n");
/* open a mailslot that doesn't exist */
- hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
+ hWriter = CreateFileA(szmspath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter == INVALID_HANDLE_VALUE, "nonexistent mailslot\n");
/* open a mailslot without the right name */
- hSlot = CreateMailslot( "blah", 0, 0, NULL );
+ hSlot = CreateMailslotA( "blah", 0, 0, NULL );
ok( hSlot == INVALID_HANDLE_VALUE,
"Created mailslot with invalid name\n");
ok( GetLastError() == ERROR_INVALID_NAME,
"error should be ERROR_INVALID_NAME\n");
/* open a mailslot with a null name */
- hSlot = CreateMailslot( NULL, 0, 0, NULL );
+ hSlot = CreateMailslotA( NULL, 0, 0, NULL );
ok( hSlot == INVALID_HANDLE_VALUE, "Created mailslot with invalid name\n");
ok( GetLastError() == ERROR_PATH_NOT_FOUND, "error should be ERROR_PATH_NOT_FOUND\n");
/* valid open, but with wacky parameters ... then check them */
- hSlot = CreateMailslot( szmspath, -1, -1, NULL );
+ hSlot = CreateMailslotA( szmspath, -1, -1, NULL );
ok( hSlot != INVALID_HANDLE_VALUE , "mailslot with valid name failed\n");
dwMax = dwNext = dwMsgCount = dwTimeout = 0;
ok( GetMailslotInfo( hSlot, &dwMax, &dwNext, &dwMsgCount, &dwTimeout ),
ok( CloseHandle(hSlot), "failed to close mailslot\n");
/* now open it for real */
- hSlot = CreateMailslot( szmspath, 0, 0, NULL );
+ hSlot = CreateMailslotA( szmspath, 0, 0, NULL );
ok( hSlot != INVALID_HANDLE_VALUE , "valid mailslot failed\n");
/* try and read/write to it */
+ count = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = ReadFile(INVALID_HANDLE_VALUE, buffer, 0, &count, NULL);
+ ok(!ret, "ReadFile should fail\n");
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError());
+ ok(count == 0, "expected 0, got %u\n", count);
+
+ count = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = ReadFile(hSlot, buffer, 0, &count, NULL);
+ ok(!ret, "ReadFile should fail\n");
+todo_wine
+ ok(GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError());
+ ok(count == 0, "expected 0, got %u\n", count);
+
count = 0;
memset(buffer, 0, sizeof buffer);
ret = ReadFile( hSlot, buffer, sizeof buffer, &count, NULL);
ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
/* now try and open the client, but with the wrong sharing mode */
- hWriter = CreateFile(szmspath, GENERIC_WRITE,
+ hWriter = CreateFileA(szmspath, GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter != INVALID_HANDLE_VALUE /* vista */ || GetLastError() == ERROR_SHARING_VIOLATION,
"error should be ERROR_SHARING_VIOLATION got %p / %u\n", hWriter, GetLastError());
if (hWriter != INVALID_HANDLE_VALUE) CloseHandle( hWriter );
/* now open the client with the correct sharing mode */
- hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
+ hWriter = CreateFileA(szmspath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter != INVALID_HANDLE_VALUE, "existing mailslot err %u\n", GetLastError());
else ok( count == 0, "wrong count %u\n", count );
/* now try open another writer... should fail */
- hWriter2 = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
+ hWriter2 = CreateFileA(szmspath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
/* succeeds on vista, don't test */
if (hWriter2 != INVALID_HANDLE_VALUE) CloseHandle( hWriter2 );
/* now try open another as a reader ... also fails */
- hWriter2 = CreateFile(szmspath, GENERIC_READ,
+ hWriter2 = CreateFileA(szmspath, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
/* succeeds on vista, don't test */
if (hWriter2 != INVALID_HANDLE_VALUE) CloseHandle( hWriter2 );
/* now try open another as a writer ... still fails */
- hWriter2 = CreateFile(szmspath, GENERIC_WRITE,
+ hWriter2 = CreateFileA(szmspath, GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
/* succeeds on vista, don't test */
if (hWriter2 != INVALID_HANDLE_VALUE) CloseHandle( hWriter2 );
/* now open another one */
- hSlot2 = CreateMailslot( szmspath, 0, 0, NULL );
+ hSlot2 = CreateMailslotA( szmspath, 0, 0, NULL );
ok( hSlot2 == INVALID_HANDLE_VALUE , "opened two mailslots\n");
/* close the client again */
* now try reopen it with slightly different permissions ...
* shared writing
*/
- hWriter = CreateFile(szmspath, GENERIC_WRITE,
+ hWriter = CreateFileA(szmspath, GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter != INVALID_HANDLE_VALUE, "sharing writer\n");
* now try open another as a writer ...
* but don't share with the first ... fail
*/
- hWriter2 = CreateFile(szmspath, GENERIC_WRITE,
+ hWriter2 = CreateFileA(szmspath, GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
/* succeeds on vista, don't test */
if (hWriter2 != INVALID_HANDLE_VALUE) CloseHandle( hWriter2 );
/* now try open another as a writer ... and share with the first */
- hWriter2 = CreateFile(szmspath, GENERIC_WRITE,
+ hWriter2 = CreateFileA(szmspath, GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter2 != INVALID_HANDLE_VALUE, "2nd sharing writer\n");
ok( CloseHandle( hSlot ), "closing the mailslot\n");
/* test timeouts */
- hSlot = CreateMailslot( szmspath, 0, 1000, NULL );
+ hSlot = CreateMailslotA( szmspath, 0, 1000, NULL );
ok( hSlot != INVALID_HANDLE_VALUE , "valid mailslot failed\n");
count = 0;
memset(buffer, 0, sizeof buffer);