-
Notifications
You must be signed in to change notification settings - Fork 6
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
Centralize installation logic & reduce admin reqs #11
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,11 +49,59 @@ std::string getSiblingFilePath(const std::string& fileName) | |
return path.substr(0, 1 + path.find_last_of('\\')) + fileName; | ||
} | ||
|
||
HRESULT registerDll(const std::string& fileName) | ||
{ | ||
USES_CONVERSION; | ||
|
||
STARTUPINFO startup_info; | ||
PROCESS_INFORMATION process_info; | ||
ZeroMemory(&startup_info, sizeof(startup_info)); | ||
startup_info.cb = sizeof(startup_info); | ||
ZeroMemory(&process_info, sizeof(process_info)); | ||
std::string command = std::string("regsvr32 /s /c \"") + getSiblingFilePath(fileName) + "\""; | ||
DWORD dwFlags = CREATE_NO_WINDOW; | ||
|
||
bool result = CreateProcessW( | ||
NULL, | ||
A2W(command.c_str()), | ||
NULL, | ||
NULL, | ||
false, | ||
dwFlags, | ||
NULL, | ||
NULL, | ||
&startup_info, | ||
&process_info | ||
); | ||
|
||
if (!result) | ||
{ | ||
return E_FAIL; | ||
} | ||
|
||
WaitForSingleObject(process_info.hProcess, INFINITE); | ||
|
||
DWORD exitCode; | ||
|
||
if (!GetExitCodeProcess(process_info.hProcess, &exitCode)) | ||
{ | ||
return E_FAIL; | ||
} | ||
|
||
CloseHandle(process_info.hProcess); | ||
CloseHandle(process_info.hThread); | ||
|
||
return exitCode == 0 ? S_OK : E_FAIL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we log the exit code in some way if it non-zero? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me! Done in a "fixup" commit. |
||
} | ||
|
||
int wmain(int argc, __in_ecount(argc) WCHAR* argv[]) | ||
{ | ||
HRESULT hr = S_OK; | ||
HRESULT hr = ::CoInitialize( NULL ); | ||
|
||
::CoInitialize( NULL ); | ||
if (SUCCEEDED(hr)) | ||
{ | ||
hr = registerDll("AutomationTtsEngine.dll"); | ||
} | ||
|
||
// Programatically create a token for the new voice and set its attributes. | ||
if (SUCCEEDED(hr)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mzgoddard I'm still only guessing about why gh-9 removes this registration, but I hesitated to accept the removal in that context because it's important for the C++ development workflow.
Since this patch relocates the registration to MakeVoice.exe, and since that doesn't be appear to be used in gh-9, I think this will address both of our needs. And (as noted in the commit message) it gets us closer to a solution where
npm install
just shells out toMakeVoice.exe
. Although I wonder if that will have a negative impact on what you're trying to achieve in gh-9.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back through the Actions logs for the runs testing the testing pr https://github.com/bocoup/aria-at-automation-driver/pull/9. Run 9 and 10 exited that registration building ttseng with code 3. Immediate searches on microsoft docs and regsvr32 didn't really help with what code 3 means. One commit in the process of debugging that issue made that removal. The next was able to build ttseng and Vocalizer and complete the other action steps.
Run 9: https://github.com/bocoup/aria-at-automation-driver/runs/4511094728?check_suite_focus=true#step:4:6386
Run 10: https://github.com/bocoup/aria-at-automation-driver/runs/4511137068?check_suite_focus=true#step:4:6386
Run 11: https://github.com/bocoup/aria-at-automation-driver/runs/4511238540?check_suite_focus=true#step:4:6444
regsvr32 doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall from the difficulty getting the dll working on an image I created that the logging functionality I added to the dll locally that it'd initialize the dll scoped logging class instance when the dll is loaded. Not that logging functionality but some other change made by regsvr32 called while building ttseng encountered an error in that context.
A result from a quick google search seems to confirm that:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some added clarity, ttseng is registered in a later step by
npm ci
.https://github.com/bocoup/aria-at-automation-driver/runs/4511238540?check_suite_focus=true#step:7:28