Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFile and Windows Calls
Forum Updated to NodeBB v4.3 + New Features

QFile and Windows Calls

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 427 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • HrishiGoblerH Offline
    HrishiGoblerH Offline
    HrishiGobler
    wrote on last edited by
    #1

    Hello there,
    Just a generic quesiton on QFile.
    I am wondering "Does QFile intern uses windows calls like "CreateFileA"?"

    The reason I am asking this is because, I am doing windows-hook to get the calls on differernt file-operations (like CreateFileA/SetFilePointer/ReadFile/CloseHandle). My function-pointer are perfectly getting call/Hit when I use std::ofstream or CFile, HOWEVER THEY DOES NOT GET CALLED/Hit WHEN I USE "Qfile".

    Is there any way out for this?
    Thanks in advance

    JonBJ 1 Reply Last reply
    0
    • HrishiGoblerH HrishiGobler

      Hello there,
      Just a generic quesiton on QFile.
      I am wondering "Does QFile intern uses windows calls like "CreateFileA"?"

      The reason I am asking this is because, I am doing windows-hook to get the calls on differernt file-operations (like CreateFileA/SetFilePointer/ReadFile/CloseHandle). My function-pointer are perfectly getting call/Hit when I use std::ofstream or CFile, HOWEVER THEY DOES NOT GET CALLED/Hit WHEN I USE "Qfile".

      Is there any way out for this?
      Thanks in advance

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @HrishiGobler
      So far as I am aware, anything which creates a file under Windows must ultimately go through CreateFile (even if it goes via _open() or whatever). However, there is CreateFileA, CreateFileW, plain CreateFile, and even a new CreateFile2. So you might need to look at those. I have also seen in https://stackoverflow.com/a/17558726/489865:

      CreateFileA/W is quite low, but not low enough to catch em all!

      To solve 2. you must hook Zw/NtCreateFile from Ntdll.dll which is what you're seeing in procmon. There is nothing lower than these API's in user land.

      However I see you mention other I/O calls and say that monitoring them is not working either. I don't know whether they would fail if your hook to original CreateFile is not functioning.

      1 Reply Last reply
      5
      • HrishiGoblerH Offline
        HrishiGoblerH Offline
        HrishiGobler
        wrote on last edited by
        #3

        Thanks a lot for your valuable reply.
        I got it fixed, just by intercepting the QtCore.dll ( I was assuming that just intercepting/hooking ucrtbase.dll would be enough and the callbacks would be triggered, but it seems it was not the case) .
        Please do let me know, if I am in the right direction.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved