MScholtes / VirtualDesktop

C# command line tool to manage virtual desktops in Windows 10
MIT License
606 stars 60 forks source link

Question: how to find enum member names ? for `APPLICATION_VIEW_CLOAK_TYPE` and `APPLICATION_VIEW_COMPATIBILITY_POLICY` #85

Closed FuPeiJiang closed 2 months ago

FuPeiJiang commented 4 months ago

is the earliest commit containing the members of APPLICATION_VIEW_CLOAK_TYPE and APPLICATION_VIEW_COMPATIBILITY_POLICY https://github.com/mzomparelli/zVirtualDesktop/commit/4c338ea38e1e20cd8a40682e28a40b7c44d2adbe ?


I thought I got close using the command below, but I can't find anything for the members of APPLICATION_VIEW_CLOAK_TYPE and APPLICATION_VIEW_COMPATIBILITY_POLICY

llvm-pdbutil dump -all "ole32.pdb"|code -

    0x85C7 | LF_FIELDLIST [size = 540, hash = 0x5414]
             - LF_ENUMERATE [ZBID_DEFAULT = 0]
             - LF_ENUMERATE [ZBID_DESKTOP = 1]
             - LF_ENUMERATE [ZBID_UIACCESS = 2]
             - LF_ENUMERATE [ZBID_IMMERSIVE_IHM = 3]
             - LF_ENUMERATE [ZBID_IMMERSIVE_NOTIFICATION = 4]
             - LF_ENUMERATE [ZBID_IMMERSIVE_APPCHROME = 5]
             - LF_ENUMERATE [ZBID_IMMERSIVE_MOGO = 6]
             - LF_ENUMERATE [ZBID_IMMERSIVE_EDGY = 7]
             - LF_ENUMERATE [ZBID_IMMERSIVE_INACTIVEMOBODY = 8]
             - LF_ENUMERATE [ZBID_IMMERSIVE_INACTIVEDOCK = 9]
             - LF_ENUMERATE [ZBID_IMMERSIVE_ACTIVEMOBODY = 10]
             - LF_ENUMERATE [ZBID_IMMERSIVE_ACTIVEDOCK = 11]
             - LF_ENUMERATE [ZBID_IMMERSIVE_BACKGROUND = 12]
             - LF_ENUMERATE [ZBID_IMMERSIVE_SEARCH = 13]
             - LF_ENUMERATE [ZBID_GENUINE_WINDOWS = 14]
             - LF_ENUMERATE [ZBID_IMMERSIVE_RESTRICTED = 15]
             - LF_ENUMERATE [ZBID_SYSTEM_TOOLS = 16]
             - LF_ENUMERATE [ZBID_LOCK = 17]
             - LF_ENUMERATE [ZBID_ABOVELOCK_UX = 18]
MScholtes commented 4 months ago

Hello @FuPeiJiang,

sorry, I think I do not really understand your question. The enums are declared this way:

    internal enum APPLICATION_VIEW_CLOAK_TYPE : int
    {
        AVCT_NONE = 0,
        AVCT_DEFAULT = 1,
        AVCT_VIRTUAL_DESKTOP = 2
    }

    internal enum APPLICATION_VIEW_COMPATIBILITY_POLICY : int
    {
        AVCP_NONE = 0,
        AVCP_SMALL_SCREEN = 1,
        AVCP_TABLET_SMALL_SCREEN = 2,
        AVCP_VERY_SMALL_SCREEN = 3,
        AVCP_HIGH_SCALE_FACTOR = 4
    }

Greetings

Markus

FuPeiJiang commented 4 months ago

Hello @MScholtes,

I couldn't find something like AVCP_TABLET_SMALL_SCREEN in the windows sdk nor on msdn, this seems to be undocumented, just like the IVirtualDesktopManagerInternal interface

I now know how to find the members of IVirtualDesktopManagerInternal thanks to https://github.com/NyaMisty/GetVirtualDesktopAPI_DIA

but the enum names remain a mystery

NyaMisty commented 4 months ago

@FuPeiJiang It's originally from @tmyt 's PR to Grabacr07/VirtualDesktop repo: https://github.com/Grabacr07/VirtualDesktop/pull/12

I believe @tmyt either found that string in the log string of related DLL, or simply named the enum based on his guess.

NyaMisty commented 4 months ago

Also it's better to use GitHub Code searching thoroughly before asking here. Because tmyt's commit is obviously earlier than the commit you mentioned.

FuPeiJiang commented 4 months ago

Thank you @NyaMisty for this response/answer

I had been wanting to find the source/first commit for this

do you have any tips for Github Code searching ? it can't sort by date, so the next question to ask is: how to find the date of first occurence in a github repo ?

I'll improve my searching algorithm: I should have checked these repo too: https://github.com/Ciantic/VirtualDesktopAccessor https://bitbucket.org/sstregg/windows-10-virtual-desktops-api/src/master/VirtualDesktopsAPI/

___

I believe @tmyt either found that string in the log string of related DLL, or simply named the enum based on his guess.

I couldn't find the string TABLET_SMALL_SCREEN in all the .dll,.pdb,.sys files on my computer, I gather the file paths using https://www.voidtools.com/ voidtools everything, and I search using node.js

, could it be that the string is compressed ? can you explain the concept of a log string ?

import { readFileSync } from 'fs'

const needle=Buffer.from("TABLET_SMALL_SCREEN","utf8")
//const needle=Buffer.from("TABLET_SMALL_SCREEN","utf-16le")

for (const v of readFileSync("paths.txt").toString().split("\n")) {
    try {
        const buf = readFileSync(v)
        if (buf.indexOf(needle) > -1) {
            console.log(v)
        }
    } catch (error) {
        console.log(error)
    }
}

debugger
MScholtes commented 3 months ago

Hello @FuPeiJiang , hello @NyaMisty,

I apologise for the late reply, I was on holiday.

The names of the enums are apparently not documented. Otherwise, enum names do not appear in the binaries, as they are only needed in the code. I think I got the names from here https://www.pg-fl.jp/program/tips/nonamefn/iappview.htm.

Greetings

Markus

MScholtes commented 2 months ago

I assume that the issue no longer exists as there is no feedback.