-
Notifications
You must be signed in to change notification settings - Fork 185
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
Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps #111
Comments
|
I call |
How are you calling |
@robmikh void IsAppContainer() {
HANDLE hToken = nullptr;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
DWORD dwSize = 0;
BOOL fIsAppContainerProcess;
if (!GetTokenInformation(hToken, TokenIsAppContainer, &fIsAppContainerProcess, sizeof(BOOL), &dwSize) ||
dwSize != sizeof BOOL) {
fIsAppContainerProcess = false;
}
if (fIsAppContainerProcess) {
LOG("It is an app container. [fIsAppContainerProcess={}]", fIsAppContainerProcess);
}
else {
LOG("It is NOT an app container. [fIsAppContainerProcess={}]", fIsAppContainerProcess);
}
}
else {
LOG("OpenProcessToken() error {}\n", (unsigned long)(GetLastError()));
}
} Codes for calling DWORD GetProcessIL(TOKEN_INFORMATION_CLASS tokenInfoCls)
{
DWORD dwRet = 0; {
HANDLE hToken = NULL;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
DWORD dwSize = 0;
// determine information length
if (!GetTokenInformation(hToken, tokenInfoCls, NULL, 0, &dwSize) &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
PTOKEN_MANDATORY_LABEL TokenInfo = (PTOKEN_MANDATORY_LABEL)malloc(dwSize);
if (TokenInfo) {
// get an actual information
if (GetTokenInformation(hToken, tokenInfoCls, TokenInfo, dwSize, &dwSize)) {
// get the integrity level
dwRet = *GetSidSubAuthority(
TokenInfo->Label.Sid,
(DWORD)(*GetSidSubAuthorityCount(TokenInfo->Label.Sid) - 1)
);
}
else {
LOG("GetSidSubAuthorityCount() error {}\n", (unsigned long)GetLastError());
}
free(TokenInfo);
}
else {
LOG("Token allocation error {}\n", (unsigned long)(GetLastError()));
}
}
else {
LOG("GetTokenInformation() error {}\n", (unsigned long)(GetLastError()));
}
CloseHandle(hToken);
}
else {
LOG("OpenProcessToken() error {}\n", (unsigned long)(GetLastError()));
}
}
return dwRet;
} |
Hi @YueLu0116, so this worked after you called both of those functions? Is it that you stopped calling it as an admin? |
Do you resolve this problem when as admin |
My Windows screen-capture sdk is built on winrt(c++) and work with electron through c++ addons. However, every time I call
CreateForMonitor
, it will throw an access-deined exception. How can I solve this issue?Windows version: Windows 10 20H2 (19042.1706)
What I have tried:
SECURITY_MANDATORY_HIGH_RID
Some similar but unsolved issues:
The text was updated successfully, but these errors were encountered: