@MASTER NickTheQuick
You have right, it's really better when KCC don't play sorcerer's apprentice
with things FRED have seriously make by default
I not have negative value now
Again thanks MASTER for your precious help
@MASTER MIJIKAÏ
I don't believe what it's happened
KCC is struck by the MASTER MIJIKAÏ effect
WonderMijikaï wrote:u can give FileMapping a try
I have searched a PB code for load the file, like you say to me, and nothing
Then KCC listening only to his courage, dared to go alone on the NET
So...Kcc taked like a grown-up a real C code of a MASTER of C and dare to try to translate it, in his love PB language, with his only one neurone
It must be said, that nulls dare everything, that's even how we recognize them
https://stackoverflow.com/questions/683 ... on-windows
Code: Select all
#include <stdio.h>
#include <Windows.h>
int main(int argc, char *argv[])
{
TCHAR *lpFileName = TEXT("hello.txt");
HANDLE hFile;
HANDLE hMap;
LPVOID lpBasePtr;
LARGE_INTEGER liFileSize;
hFile = CreateFile(lpFileName,
GENERIC_READ, // dwDesiredAccess
0, // dwShareMode
NULL, // lpSecurityAttributes
OPEN_EXISTING, // dwCreationDisposition
FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes
0); // hTemplateFile
if (hFile == INVALID_HANDLE_VALUE) {
fprintf(stderr, "CreateFile failed with error %d\n", GetLastError());
return 1;
}
if (!GetFileSizeEx(hFile, &liFileSize)) {
fprintf(stderr, "GetFileSize failed with error %d\n", GetLastError());
CloseHandle(hFile);
return 1;
}
if (liFileSize.QuadPart == 0) {
fprintf(stderr, "File is empty\n");
CloseHandle(hFile);
return 1;
}
hMap = CreateFileMapping(
hFile,
NULL, // Mapping attributes
PAGE_READONLY, // Protection flags
0, // MaximumSizeHigh
0, // MaximumSizeLow
NULL); // Name
if (hMap == 0) {
fprintf(stderr, "CreateFileMapping failed with error %d\n", GetLastError());
CloseHandle(hFile);
return 1;
}
lpBasePtr = MapViewOfFile(
hMap,
FILE_MAP_READ, // dwDesiredAccess
0, // dwFileOffsetHigh
0, // dwFileOffsetLow
0); // dwNumberOfBytesToMap
if (lpBasePtr == NULL) {
fprintf(stderr, "MapViewOfFile failed with error %d\n", GetLastError());
CloseHandle(hMap);
CloseHandle(hFile);
return 1;
}
// Display file content as ASCII charaters
char *ptr = (char *)lpBasePtr;
LONGLONG i = liFileSize.QuadPart;
while (i-- > 0) {
fputc(*ptr++, stdout);
}
UnmapViewOfFile(lpBasePtr);
CloseHandle(hMap);
CloseHandle(hFile);
printf("\nDone\n");
}
And i don't say to you what's happened ?
WonderMijikaï wrote:Yes yes !!! say to me what's happened !!!

Ok..Ok... i say to you....i say to you.... MASTER
For the first time of my life....so nearly 40 years of bad programmation
The code working !!!!!
Probably like a potato in a washing machine...but it spins !!!
Code: Select all
File$ = "D:\Video\TheMovieAtKcc.mkv"
UseMD5Fingerprint()
Size = FileSize(File$)
Name$ = "Kcc"
hFile = CreateFile_(@File$, #GENERIC_READ, 0, #Null, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL,0)
If hFile
hMap = CreateFileMapping_(hFile, #Null, #PAGE_READONLY, 0,0,#Null)
If hMap
MapSize = GetFileSize_(hFile, 0)
Debug MapSize
*lpBasePtr = MapViewOfFile_(hMap, #FILE_MAP_READ, 0, 0, 0)
If *lpBasePtr
Debug *lpBasePtr
HeureDebut = ElapsedMilliseconds()
Debug Fingerprint(*lpBasePtr, MapSize, #PB_Cipher_MD5)
Debug StrF((ElapsedMilliseconds() - HeureDebut) / 1000) + " secondes"
UnmapViewOfFile_(*lpBasePtr);
CloseHandle_(hMap);
CloseHandle_(hFile);
HeureDebut = ElapsedMilliseconds()
Debug FileFingerprint(File$, #PB_Cipher_MD5)
Debug StrF((ElapsedMilliseconds() - HeureDebut) / 1000) + " secondes"
EndIf
EndIf
EndIf
The bad new is (because with KCC, you see later, there are always a bad news in the end

)
That works faster than previous Kcc cowpat
But a little bit slower than FRED FileFingerprint() function i found just now, when i want have information about Fingerprint
Debugger wrote: MapSize = 812503724
*lpBasePtr = 59637760
Fingerprint = 36dbf8bce3dfa90a161d639b7091624c
in 1.7879999876 secondes
FileFingerprint = 36dbf8bce3dfa90a161d639b7091624c
in 1.7589999437 secondes
I believe there are no way for do that faster
Then ....one thousand of thanks at you two 