[](https://d.tube/v/ntstatus01/QmVSBghLksnen6swvTrQ1DLbCMUXR6RW6vLN1hEMv2TiA4) [DTube Video Link](https://d.tube/#!/v/ntstatus01/QmVSBghLksnen6swvTrQ1DLbCMUXR6RW6vLN1hEMv2TiA4) ``` #pragma comment(lib, "ntdll.lib") #include <Windows.h> #include <winternl.h> #define FileStandardInformation 5 typedef struct _FILE_STANDARD_INFORMATION { LARGE_INTEGER AllocationSize; LARGE_INTEGER EndOfFile;// file size ULONG NumberOfLinks; BOOLEAN DeletePending; BOOLEAN Directory; } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; BOOL GetFileSizeNtdll(PCWSTR path, PLARGE_INTEGER pFSize) { UNICODE_STRING pathUniStr; OBJECT_ATTRIBUTES obja; IO_STATUS_BLOCK iost; HANDLE hFile; FILE_STANDARD_INFORMATION fileStInfo; RtlDosPathNameToNtPathName_U(path, &pathUniStr, NULL, NULL); InitializeObjectAttributes(&obja, &pathUniStr, OBJ_CASE_INSENSITIVE, NULL, NULL); if (!NT_SUCCESS(NtCreateFile(&hFile, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &obja, &iost, NULL, 0, 0, FILE_OPEN, 0, NULL, 0))) return FALSE; if (!NT_SUCCESS(NtQueryInformationFile(hFile, &iost, &fileStInfo, sizeof(fileStInfo), FileStandardInformation))) return FALSE; *pFSize = fileStInfo.EndOfFile; NtClose(hFile); } BOOL GetFileSizeKernel32(PCWSTR path, PLARGE_INTEGER pFSize) { HANDLE hFile; BOOL ret; if ((hFile = CreateFileW(path, FILE_READ_ATTRIBUTES | SYNCHRONIZE, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) return FALSE; ret= GetFileSizeEx(hFile, pFSize); CloseHandle(hFile); return ret; } int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { LARGE_INTEGER fSize1,fSize2; //Method 1 GetFileSizeKernel32(L"C:\\Users\\la\\Desktop\\test.txt",&fSize1); //Method 2 GetFileSizeNtdll(L"C:\\Users\\la\\Desktop\\test.txt", &fSize2); return 0; } ``` Please Vote this post if you like it. Please Follow me if you like my posts. If you have any questions about this post, ask in comments. Follow me on : [DTube](https://d.tube/#!/c/ntstatus01)
author | ntstatus |
---|---|
permlink | get-file-size-with-kernel32 |
category | programming |
json_metadata | {"links":["https://d.tube/v/ntstatus01/QmVSBghLksnen6swvTrQ1DLbCMUXR6RW6vLN1hEMv2TiA4","https://d.tube/#!/v/ntstatus01/QmVSBghLksnen6swvTrQ1DLbCMUXR6RW6vLN1hEMv2TiA4","https://d.tube/#!/c/ntstatus01"],"tags":["programming","windows","dtube"],"app":"ecency/3.0.19-vision","format":"markdown+html","image":["https://images.ecency.com/DQmdNkymP4P4Q5MW94vmE3SVCySnupQefhL4nnHpHugUJsq/filesize.png"]} |
created | 2021-09-17 19:44:18 |
last_update | 2021-09-22 20:40:03 |
depth | 0 |
children | 1 |
last_payout | 2021-09-24 19:44:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,122 |
author_reputation | 5,617,331,478 |
root_title | "Get File Size with Kernel32 Api and Ntdll Api (Native Api)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 106,364,506 |
net_rshares | 6,678,891,954 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tipy | 0 | 4,895,743,236 | 100% | ||
gangstalking | 0 | 1,906,876,342 | 1% | ||
anddumbcunts | 0 | -123,727,624 | -1% |
Electronic-terrorism, voice to skull and neuro monitoring on Hive and Steem. You can ignore this, but your going to wish you didnt soon. This is happening whether you believe it or not. https://ecency.com/fyrstikken/@fairandbalanced/i-am-the-only-motherfucker-on-the-internet-pointing-to-a-direct-source-for-voice-to-skull-electronic-terrorism
author | gangstalking |
---|---|
permlink | re-ntstatus-get-file-size-with-kernel32-20210918t163340012z |
category | programming |
json_metadata | {"app":"hive-bot/0.6.3"} |
created | 2021-09-18 16:33:42 |
last_update | 2021-09-18 16:33:42 |
depth | 1 |
children | 0 |
last_payout | 2021-09-25 16:33:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 343 |
author_reputation | -67,597,107,868,724 |
root_title | "Get File Size with Kernel32 Api and Ntdll Api (Native Api)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 106,384,823 |
net_rshares | -28,119,345,314 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
spaminator | 0 | -5,109,713,627 | -0.25% | ||
mmmmkkkk311 | 0 | -23,009,631,687 | -0.25% |