NO

Author Topic: WiW  (Read 3759 times)

Offline John Z

  • Member
  • *
  • Posts: 790
Re: WiW
« Reply #15 on: May 01, 2021, 03:24:55 PM »
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

  • Guest
Re: WiW
« Reply #16 on: May 01, 2021, 03:57:39 PM »
I will remove it.

Grincheux

  • Guest
Re: WiW
« Reply #17 on: May 01, 2021, 05:50:37 PM »
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

  • Guest
Re: WiW
« Reply #18 on: May 02, 2021, 05:59:26 AM »
Note about LVCOLUMN

Quote
Remarks: 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
« Last Edit: May 05, 2021, 06:04:44 AM by Grincheux »

Grincheux

  • Guest
Re: WiW
« Reply #19 on: May 02, 2021, 10:23:38 AM »
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

Offline John Z

  • Member
  • *
  • Posts: 790
Re: WiW
« Reply #20 on: May 02, 2021, 12:51:34 PM »
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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: WiW
« Reply #21 on: May 02, 2021, 01:09:20 PM »
I don't have too much time playing with it right now, but... looks good!
/Pelle

Offline John Z

  • Member
  • *
  • Posts: 790
Re: WiW
« Reply #22 on: May 02, 2021, 02:35:40 PM »
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

  • Guest
Re: WiW
« Reply #23 on: May 02, 2021, 02:57:11 PM »
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

  • Guest
Re: WiW
« Reply #24 on: May 02, 2021, 07:50:00 PM »
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)
Quote
BOOL 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
Code: [Select]
                     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.
« Last Edit: May 02, 2021, 07:55:41 PM by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: WiW
« Reply #25 on: May 03, 2021, 10:59:18 AM »
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:
Quote
By 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. 
 
« Last Edit: May 03, 2021, 02:00:38 PM by John Z »

Grincheux

  • Guest
Re: WiW
« Reply #26 on: May 03, 2021, 08:25:11 PM »
Quote
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.

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

Code: [Select]
                     mov      rcx,OFFSET szSeDebugPrivilege
                     call   EnableWindowsPrivilege

With this function, I get "ERROR_NOT_ALL_ASSIGNED"
This should be the reason why OpenProcess fails.
« Last Edit: May 03, 2021, 09:10:46 PM by Grincheux »

Grincheux

  • Guest
Re: WiW
« Reply #27 on: May 03, 2021, 09:12:17 PM »

I HAVE FOUND
This is a new version
« Last Edit: May 04, 2021, 12:54:03 PM by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: WiW
« Reply #28 on: May 03, 2021, 09:37:09 PM »
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

  • Guest
Re: WiW
« Reply #29 on: May 03, 2021, 10:19:56 PM »
It seems that Windows does not list all the windows. Metro...