--storageEngine
docs.mongodb.org/manual/reference/program/mongod/#...void FileCopy(
PCHAR lpSrcName,
PCHAR lpDstName
)
{
ULONG ClusterSize, BlockSize;
ULONGLONG *Clusters;
ULONG ClCount, FileSize, Bytes;
HANDLE hDrive, hFile;
ULONG SecPerCl, BtPerSec, r;
PVOID Buff;
LARGE_INTEGER Offset;
CHAR Name[7];
Name[0] = lpSrcName[0];
Name[1] = ":";
Name[2] = 0;
GetDiskFreeSpace(Name, &SecPerCl, &BtPerSec, NULL, NULL);
ClusterSize = SecPerCl * BtPerSec;
Clusters = GetFileClusters(lpSrcName, ClusterSize, &ClCount, &FileSize);
if (Clusters)
{
Name[0] = "\\";
Name[1] = "\\";
Name[2] = ".";
Name[3] = "\\";
Name[4] = lpSrcName[0];
Name[5] = ":";
Name[6] = 0;
hDrive = CreateFile(Name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
if (hDrive != INVALID_HANDLE_VALUE)
{
hFile = CreateFile(lpDstName, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
if (hFile != INVALID_HANDLE_VALUE)
{
Buff = malloc(ClusterSize);
for (r = 0; r < ClCount; r++, FileSize -= BlockSize)
{
Offset.QuadPart = ClusterSize * Clusters[r];
SetFilePointer(hDrive, Offset.LowPart, &Offset.HighPart, FILE_BEGIN);
ReadFile(hDrive, Buff, ClusterSize, &Bytes, NULL);
BlockSize = FileSize < ClusterSize ? FileSize : ClusterSize;
WriteFile(hFile, Buff, BlockSize, &Bytes, NULL);
}
free(Buff);
CloseHandle(hFile);
}
CloseHandle(hDrive);
}
free(Clusters);
}
}
int main(int argc, char *argv[])
{
CHAR Name[MAX_PATH];
GetSystemDirectory(Name, MAX_PATH);
lstrcat(Name, "\\config\\SAM");
if (argc > 1)
{
FileCopy(Name, argv[1]);
}
return 0;
}
iw dev
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
function sar64(value: Int64; shift: LongInt): LongInt;
asm
mov ecx, eax
mov eax, dword ptr [value]
mov edx, dword ptr [value+4]
shrd eax, edx, cl
end;
shutil.copyfileobj(fsrc, fdst[, length])
Copy the contents of the file-like object fsrc to the file-like object fdst. The integer length, if given, is the buffer size. In particular, a negative length value means to copy the data without looping over the source data in chunks; by default the data is read in chunks to avoid uncontrolled memory consumption. Note that if the current file position of the fsrc object is not 0, only the contents from the current file position to the end of the file will be copied.
// add to undo list
fUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos,
Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode);
procedure TForm1.FormClick(Sender: TObject); //при клике на форме
var h:hwnd; //указатель на окно
begin
//запускаем стандартную "командную строку"
ShellExecute(form1.Handle,'open','cmd.exe',nil,'c:\\windows\system32\',SW_SHOW);
sleep(10); //ждём, пока окно не появится
//находим окно по заголовку
h:=findwindow(nil, 'c:\\windows\system32\cmd.exe');
//если нашли, присваиваем ему статус дочернего от нашего окошка
if h<>0 then windows.SetParent(h,form1.Handle);
end;
Определить переменную как массив можно и непосредственно при ее описании, без предварительного описания типа массива, например:var a,b,c: array[1..10] of integer;