T
Test Name
The code pasted below generates the following error
1450 Insufficient system resources exist to complete the requested
service. ERROR_NO_SYSTEM_RESOURCES
when it writes an approximately 64MB block of data to a file share. The
source and destination systems in the test were Windows 2000. The source
system running the program below is running SP3, and the destination system
with file share is SP4. I don't think the SP's matter as I tried other tests
with others sytems.
My **guess** is that the source system's Workstation and/or file sharing
drivers cannot handle the 64MB request from sent from the WriteFile API.
This is a guess so any hints are welcome. A workaround is to send smaller
chunks, and that's fine, but I thought it was worth seeing if anyone had
thoughts on this. Since error 1450 is used in so many scenarios, it seems
that the answer lies in Microsoft's source code or with someone who's
familiar with this problem and/or internals causing this.
Thanks,
Thomas
----
#include "stdafx.h"
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
// fails on 67076033 but succeeds on 67076032 on write from Win2K to Win2K
//unsigned long ulSizeToTest = 64*1024*1024; // fails.
unsigned long ulSizeToTest = 67076033; // fails.
//unsigned long ulSizeToTest = 67076032; // succeeds.
printf("Testing %lu bytes\n", ulSizeToTest);
int fdWrite = _wopen(L"\\\\somemachine\\myshare\\big.dat", O_WRONLY |
O_CREAT | O_APPEND | O_BINARY | O_NOINHERIT, 0666);
/*
The open style doesn't matter. This fails too. FYI.
HANDLE h = CreateFile(
"\\\\talaptop\\myshare\\big.dat",
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
*/
if (fdWrite != -1) {
HANDLE h = (HANDLE) _get_osfhandle(fdWrite);
char *pLarge = new char[ulSizeToTest];
if (pLarge) {
memset(pLarge, 32, ulSizeToTest);
DWORD dwWritten = 0;
if (WriteFile(h, pLarge, ulSizeToTest, &dwWritten, NULL)) {
printf("Write succeeded %ld bytes.\n", dwWritten);
}
else {
printf("Write failed: %d.\n", GetLastError());
}
}
else
printf("Can't create large bug. %d\n", GetLastError());
_close(fdWrite);
}
else {
printf("Fail open for write. %d\n", GetLastError());
}
return 0;
}
1450 Insufficient system resources exist to complete the requested
service. ERROR_NO_SYSTEM_RESOURCES
when it writes an approximately 64MB block of data to a file share. The
source and destination systems in the test were Windows 2000. The source
system running the program below is running SP3, and the destination system
with file share is SP4. I don't think the SP's matter as I tried other tests
with others sytems.
My **guess** is that the source system's Workstation and/or file sharing
drivers cannot handle the 64MB request from sent from the WriteFile API.
This is a guess so any hints are welcome. A workaround is to send smaller
chunks, and that's fine, but I thought it was worth seeing if anyone had
thoughts on this. Since error 1450 is used in so many scenarios, it seems
that the answer lies in Microsoft's source code or with someone who's
familiar with this problem and/or internals causing this.
Thanks,
Thomas
----
#include "stdafx.h"
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
// fails on 67076033 but succeeds on 67076032 on write from Win2K to Win2K
//unsigned long ulSizeToTest = 64*1024*1024; // fails.
unsigned long ulSizeToTest = 67076033; // fails.
//unsigned long ulSizeToTest = 67076032; // succeeds.
printf("Testing %lu bytes\n", ulSizeToTest);
int fdWrite = _wopen(L"\\\\somemachine\\myshare\\big.dat", O_WRONLY |
O_CREAT | O_APPEND | O_BINARY | O_NOINHERIT, 0666);
/*
The open style doesn't matter. This fails too. FYI.
HANDLE h = CreateFile(
"\\\\talaptop\\myshare\\big.dat",
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
*/
if (fdWrite != -1) {
HANDLE h = (HANDLE) _get_osfhandle(fdWrite);
char *pLarge = new char[ulSizeToTest];
if (pLarge) {
memset(pLarge, 32, ulSizeToTest);
DWORD dwWritten = 0;
if (WriteFile(h, pLarge, ulSizeToTest, &dwWritten, NULL)) {
printf("Write succeeded %ld bytes.\n", dwWritten);
}
else {
printf("Write failed: %d.\n", GetLastError());
}
}
else
printf("Can't create large bug. %d\n", GetLastError());
_close(fdWrite);
}
else {
printf("Fail open for write. %d\n", GetLastError());
}
return 0;
}