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

Update for Electron 8 #70

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/windows.js
Expand Up @@ -89,9 +89,9 @@ function windows() {
// Write the window text to the buffer (it returns the text size, but it's not used here)
user32.GetWindowTextW(activeWindowHandle, windowTextBuffer, windowTextLength + 2);
// Remove trailing null characters
const windowTextBufferClean = ref.reinterpretUntilZeros(windowTextBuffer, wchar.size);
const dirtyTitle = wchar.toString(windowTextBuffer);
// The text as a JavaScript string
const windowTitle = wchar.toString(windowTextBufferClean);
const windowTitle = dirtyTitle.replace(/\0/g, '');

// Allocate a buffer to store the process ID
const processIdBuffer = ref.alloc('uint32');
Expand All @@ -117,9 +117,9 @@ function windows() {
// Write process file path to buffer
kernel32.QueryFullProcessImageNameW(processHandle, 0, processFileNameBuffer, processFileNameSizeBuffer);
// Remove null characters from buffer
const processFileNameBufferClean = ref.reinterpretUntilZeros(processFileNameBuffer, wchar.size);
const pathDirty = wchar.toString(processFileNameBuffer);
// Get process file path as a string
const processPath = wchar.toString(processFileNameBufferClean);
const processPath = pathDirty.replace(/\0/g, '');
// Get process file name from path
const processName = path.basename(processPath);

Expand Down