Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still working? #3

Open
pepeu93 opened this issue Dec 19, 2022 · 2 comments
Open

Still working? #3

pepeu93 opened this issue Dec 19, 2022 · 2 comments

Comments

@pepeu93
Copy link

pepeu93 commented Dec 19, 2022

I tried it with a png file on win10 the file didn't get unlocked.

#include <iostream>
#include "unlocker.h"
int main()
{
    auto file = unlocker::Path::Exists(L"D:/resize.png");
    if (file)
    {
        auto err = file->Unlock();
        std::cout << err;
    }
    std::cout << "Hello World!\n";
}

I tried it with admin rights.

@orca-zhang
Copy link
Member

orca-zhang commented Jan 3, 2023

I'd like to provide a SlowUnlock function that scan and try to close memory-mapping files in all the processes. And it's only tried to close memory-mapping files in those processes that it find specified handle now.

@orca-zhang
Copy link
Member

orca-zhang commented Jan 12, 2023

You can quick test by small modification

https://github.com/ez8-co/unlocker/blob/master/unlocker.hpp#L904

Move out CloseMapViewOfFile without check the result that remove the if condition.

if (CloseMapViewOfFile(hProcess, path.c_str())) {

->

CloseMapViewOfFile(hProcess, path.c_str()); {

Which is said that it will try to duplicate every memory-mapping file handle in all processes so that it will be very slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants