Frank,
Aaron has left the company to goto Africa to setup water filtering systems, and I'm not a Windows expert, but I'll take a look at your code:
hFlashFile = FindFirstFile ( TEXT("*.*"), &fd);
Can you include more of your function? I want to see how you are initializing everything.
if (hFlashFile != INVALID_HANDLE_VALUE) {
do {
NKDbgPrintfW(TEXT("Found File: %s \r\n"), fd.cFileName);
} while (FindNextFile (hFlashFile, &fd));
FindClose (hFlashFile);
}
hFlashFile = CreateFile(TEXT ("YaffsPart1"),GENERIC_READ|GENERIC_WRITE,
0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
I don't think YaffsPart1 is a file, but a directory, right? Can you print out the FILE_ATTRIBUTE_DIRECTORY parameter? Maybe you should try hFlashFile = FindFirstFile ( TEXT("\\YaffsPart1\*.*"), &fd); to see inside the partition? Or maybe try hFlashFile = CreateFile(TEXT ("\\YaffsPart1\testfile"),GENERIC_READ|GENERIC_WRITE,
0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL); to create a file?
if (hFlashStore == INVALID_HANDLE_VALUE) {
I don't understand where hFlashStore came from. Is this supposed to be hFlashFile?
NKDbgPrintfW(TEXT("open failed"));
}
else {
my_int = 500;
WriteFile(hFlashFile, &my_int, 4, &iBytes, NULL);
iBytes = -1 * iBytes;
SetFilePointer(hFlashFile, iBytes, NULL, FILE_CURRENT);
CloseHandle(hFlashFile);
}