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

an error occurred trying to start process "rundll32." exe with working directory c:\Windows\System32 access is denied #201

Open
jh-mobitech opened this issue Dec 9, 2024 · 8 comments

Comments

@jh-mobitech
Copy link

an error occurred trying to start process "rundll32." exe with working directory c:\Windows\System32 access is denied

Get this error when use MAUI to call Google Auth:

#if WINDOWS
try
{
var result = await WinUIEx.WebAuthenticator.AuthenticateAsync(new Uri(authUrl), new Uri(redirectUri));
var authCode = result?.Properties["code"];
Console.WriteLine($"Google authCode:{authCode}");
string accessToken = await ExchangeCodeForAccessToken(authCode);
Console.WriteLine($"Google accessToken:{accessToken}");
Preferences.Set(CommenSetting.GoogleDriveAccessToken, accessToken);
return accessToken == null ? "" : accessToken;
}
catch (Exception ex)
{
_ = Application.Current?.MainPage?.DisplayAlert(Localization.Resources.title_alert, ex.Message, Localization.Resources.btn_ok);
Console.WriteLine($"Google Unknow Error:{ex.Message}");
return "";
}
#else

Any Idea?

@jh-mobitech
Copy link
Author

image

@dotMorten
Copy link
Owner

It doesn’t appear to be a WinUIEx issue but do you have a reproducer app you can share? The above didn’t give much to go on

@jh-mobitech
Copy link
Author

Thanks for your quick response.

Well, I just called

            try
            {
                var result = await WinUIEx.WebAuthenticator.AuthenticateAsync(new Uri(authUrl), new Uri(redirectUri));
            }
            catch (Exception ex)
            {
               _ = Application.Current?.MainPage?.DisplayAlert(Localization.Resources.title_alert, ex.Message, Localization.Resources.btn_ok);
                Console.WriteLine($"Google Unknow Error:{ex.Message}");
                return "";
            }

and then it goes to catch block and the error is

an error occurred trying to start process "rundll32." exe with working directory c:\Windows\System32 access is denied

It works in one Windows laptop but fails in a new laptop.

try to run VS as Adminitrator but also not works. It is a MAUI project and happens when I debugging the code.

@jh-mobitech
Copy link
Author

image

I checked the source code and it did try to open rundll32.exe there.

Do you have any suggestion why this happen? Thanks.

@dotMorten
Copy link
Owner

I see. That’s odd. Must be some odd security configuration that machine has. If you figure out what setting causes it I would love to know

@jh-mobitech
Copy link
Author

OK, Can't find out the cause so wonder if I can get any help form you.

Anyway, Thanks. Will update here if I solved it.

@dotMorten
Copy link
Owner

Sorry never seen this before or know why this is failing to launch

@dotMorten
Copy link
Owner

dotMorten commented Dec 20, 2024

What if you run that bit of code to launch the browser from a little console app or something else. Do you see the same thing happening there on that machine? It's a pretty standard way to launch the default browser on Windows.

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

No branches or pull requests

2 participants