I used DUMPBIN utility of Microsoft Visual C++ on the following program. I know for sure that the call to remove eventually calls the Microsoft system call of DeleteFileW from the kernel32.dll (I confirm this call with another tool).
So why when I apply DUMPBIN /imports on the .EXE of the following program I don't see the DeleteFileW system call?
How do I see the system call of DeleteFileW using DUMPBIN ?
Thanks, Gilad
#include "stdafx.h"
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
int main()
{
const char* fileName = "gilad.txt";
this_thread::sleep_for(chrono::milliseconds(10*1000));
if (remove(fileName) != 0)
cout << "Remove operation failed" << endl;
else
cout << *fileName << " has been removed." << endl;
return 0;
}
Your code does not call
DeleteFileW, it callsremove. Presumably frommsvcrt.dll. Yes, after thatmsvcrt.dllcallsDeleteFileWfor you, but that part does not appear in your executable file.(And
dumpbinworks on a single file, it does not track dependencies of other files)You would have to run
dumpbinon a file actually referringDeleteFileW. Which is not the code above, but another one you may create using WinAPI, or just as an experiment, run it onmsvcrt.dll.