News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

WiW

Started by Grincheux, April 25, 2021, 10:27:46 AM

Previous topic - Next topic

John Z

I found the problem - no ini file.  I re-extracted the ini file into the exe directory and it runs.

Soooo - if the ini file ever disappears there would be no way to get the program to run again....
Seems if the ini file can't be found a default ini file should automatically be created so that the
program still works . . . . just a suggestion.

John Z

Grincheux

I will remove it.

Grincheux

Bug corrected.
When pressing the F5 key the listview content was not refreshed.
Removed SteWindowsAffinity, no need Wiw.ini file.


The first image shows the main screen.
The second shows the children of PhotoFilvtre 11.0
The last shows Pelle's IDE children

Grincheux

#18
Note about LVCOLUMN

QuoteRemarks: If a column is added to a list-view control with index 0 (the leftmost column), it is always LVCFMT_LEFT. Setting other flags on column 0 does not override that alignment. Therefore if you keep inserting columns with index 0, the text in all columns are left-aligned. If you want the first column to be right-aligned or centered you can make a dummy column, then insert one or more columns with index 1 or higher and specify the alignment you require. Finally delete the dummy column.
https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvcolumna

Grincheux

Added windows potion, width and Height.

There is a problem taht I don't append to solve when sorting on these columns 0 si lower than a negatif number!
I join the current version

John Z

Thanks - grabbed it. 

I had noticed the Menu Refresh didn't change the form.  I was trying to see before and after starting my vCard program.  I'll try this new one.

Fortunately in my use of the listview table I did not keep inserting at column 0.  It is a good tip you provided about that Micro$oft issue.

John Z

Pelle

I don't have too much time playing with it right now, but... looks good!
/Pelle

John Z

Hi Grincheux,

Got the new one working - looks pretty good.  However maybe some issue which could just be my understanding.

Here is what I did
Start the WiW program - looks good,  reviewed windows title column.
Started a program, hit refresh and saw my program window Title, but the filename column was blank (attachment 1).
  Within the program I started I opened another window, actually a table in a window like yours.
  hit refresh and saw the second window title shown in the Window Title column but the window FileName
  column attributed the window to WiW.exe and not my program(attachment 2).

  Started another sub window within my program, again hit refresh, WiW then saw that window title too, but
  also attributed it to WiW.exe and not my program(attachment 3).

So this maybe my understanding issue, or could be WiW is not retrieving the base file program name correctly all of the time.

Now - here is just a personal preference - I wish when WiW starts it did not automatically consume my entire screen.   :)

A suggestion:  I was trying to compare before and after starting a specific program to see changes.  To do that I needed to do screen shots or run two instances of WiW without refreshing the first.  It could be useful to be able to export the table to a comma separated output file, then two output files could be compared to see what changed.  Alternatively F5 could highlight changes when refreshing.  New/changed entries from the prior run could be highlighted -- well this might a very aggressive idea..  Anyway just a suggestion, you may have accomplished your original concept and it is very useful as is. 

The ability to sort by any column is very helpful.

Thanks for your hard work!

John Z

Grincheux

Thank You John for these good remarks.


I will some changes like you said.


For the filename not displayed, I knew it and tested an other program written by Hutch on Masm32, he has the same problem. For the instant I have no answer, I continue to search.

Grincheux

#24
I try to get the full path and filename.
The problem is how to get the flename of an other process

For doing this, set DebugPrivilege (I found someone that wrote a function)
QuoteBOOL EnableDebugPrivilege(BOOL bEnable)
{
    HANDLE hToken = NULL;
    LUID luid;

    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) return FALSE;
    if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) return FALSE;

    TOKEN_PRIVILEGES tokenPriv;
    tokenPriv.PrivilegeCount = 1;
    tokenPriv.Privileges[0].Luid = luid;
    tokenPriv.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;

    if (!AdjustTokenPrivileges(hToken, FALSE, &tokenPriv, sizeof(TOKEN_PRIVILEGES), NULL, NULL)) return FALSE;

    return TRUE;
}


my code
                     mov      [_dwProcessID],ecx
                     mov      [_hModule],rdx

                     mov      ecx,TRUE
                     call   EnableDebugPrivilege

                     mov      ecx,PROCESS_QUERY_INFORMATION or READ_CONTROL or PROCESS_VM_READ
                     xor      edx,edx
                     mov      r8d,_dwProcessID
                     call   OpenProcess   ; ALWAYS RETURNS 0 AND GetLastError gives 0x57

                     test   rax,rax
                     jz      @Eoj

                     mov      [_hProcess],rax

                     mov      rcx,rax
                     xor      edx,edx
                     lea      r8,_szModuleName
                     mov      r9d,SIZEOF _szModuleName
                     call   QueryFullProcessImageNameA

                     mov      rcx,[_hProcess]
                     call   CloseHandle


0x57 = Bad Parameter
I always get an error. Could you help me.

John Z

#25
I'll give the C version a try and see what happens.

I did suspect that privilege's might have been an issue when I tried your program so I also ran it explicitly as an administrator.  The results were the same.  I mention this because in looking over Debug Privilege I found this:
QuoteBy default, this property is enabled for users with Administrator rights. A user with Administrator privileges can enable this property for other user groups.
So it seems that even if the code were working it may not produce the desired capability.

John Z

P.S It is possible that it does work in your program but only the first time used?  I noticed in some sample code that it explicitly frees hToken with CloseHandle.  In that example hToken is a Global though so maybe in yours it is not needed.

Update: OpenProcess requires three inputs dword DesiredAccess,  bool inherithandle, and dword ProcessID
since DesiredAccess and InheritHandle seem to be constants I'd guess the dword ProcessID is wrong?

Update2: In the C version a bad process ID gives a "The Parameter is incorrect" error code.  A good process ID by using GetCurrentProcessId() works. 

Grincheux

#26
QuoteUpdate2: In the C version a bad process ID gives a "The Parameter is incorrect" error code.  A good process ID by using GetCurrentProcessId() works.

Ok, but the files we want are into an other process.
I have tried in setting admin rights into the manifest, no change

                     mov      rcx,OFFSET szSeDebugPrivilege
                     call   EnableWindowsPrivilege

With this function, I get "ERROR_NOT_ALL_ASSIGNED"
This should be the reason why OpenProcess fails.

Grincheux

#27

I HAVE FOUND
This is a new version

John Z

Great work!!!!
It is really working well I see a lot of filenames now.  Very informative.

I'm a bit suspicious though that there are exactly 254 ......  ;)

Impressive,

John Z

Grincheux

It seems that Windows does not list all the windows. Metro...