Windows: .blend file association detection #99438

Closed
opened 2022-07-04 17:03:23 +02:00 by Sybren A. Stüvel · 10 comments

On Windows, Flamenco Worker should detect which Blender to use by inspecting the file association for *.blend files. This happens in internal/worker/find_blender/windows.go.

It has worked on my Windows 10 Pro desktop system, but failed months later on my Windows 10 Home laptop. Not sure if the pro/home version of Windows matters, whether the breakage was caused by something else, or whether it never worked properly but I failed to notice.

The code works by calling the AssocQueryStringW function from shlwapi.dll. The error message it produces is "The data area passed to a system call is too small."

To test, run go test ./internal/find_blender/ -args -withBlender.

On Windows, Flamenco Worker should detect which Blender to use by inspecting the file association for `*.blend` files. This happens in [internal/worker/find_blender/windows.go](https://developer.blender.org/diffusion/F/browse/main/internal/worker/find_blender/windows.go). It has worked on my Windows 10 Pro desktop system, but failed months later on my Windows 10 Home laptop. Not sure if the pro/home version of Windows matters, whether the breakage was caused by something else, or whether it never worked properly but I failed to notice. The code works by calling the [AssocQueryStringW](https://docs.microsoft.com/en-gb/windows/win32/api/shlwapi/nf-shlwapi-assocquerystringw) function from `shlwapi.dll`. The error message it produces is "The data area passed to a system call is too small." To test, run `go test ./internal/find_blender/ -args -withBlender`.
Author
Owner

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Owner

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
		result1, _, err := syscall.SyscallN(
		assocQueryString,
		uintptr(ASSOCF_INIT_DEFAULTTOSTAR), // [in]            ASSOCF   flags
		uintptr(ASSOCSTR_EXECUTABLE),       // [in]            ASSOCSTR str

I'll admit, i don't know go, but this bit looks suspicious, flags and str should be 32 bits in size, and i'm guessing uintptr will output a 64 bit value on a 64 bit system?

``` result1, _, err := syscall.SyscallN( assocQueryString, uintptr(ASSOCF_INIT_DEFAULTTOSTAR), // [in] ASSOCF flags uintptr(ASSOCSTR_EXECUTABLE), // [in] ASSOCSTR str ```` I'll admit, i don't know go, but this bit looks suspicious, flags and str should be 32 bits in size, and i'm guessing uintptr will output a 64 bit value on a 64 bit system?
Author
Owner

Unfortunately, the syscall.SyscallN function only takes uintptr arguments, so I can't really change anything there.

I'll update the patch description with a way to properly test this issue.

Unfortunately, the `syscall.SyscallN` function only takes `uintptr` arguments, so I can't really change anything there. I'll update the patch description with a way to properly test this issue.

Added subscriber: @nrupsis

Added subscriber: @nrupsis

Ran the test on my home machine (Windows 11) and it seemed to work.

System Details:
Device name -PC
Processor Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz 2.00 GHz
Installed RAM 64.0 GB
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display

Edition Windows 11 Pro
Version 21H2
Installed on ‎7/‎4/‎2022
OS build 22000.739
Experience Windows Feature Experience Pack 1000.22000.739.0

Running the command I think worked? But I'm basing that of the fact nothing crashed:

image.png

A curious thing to note however, is that blender is installed on my computer, however It doesn't appear to be in my path:

image.png

Ran the test on my home machine (Windows 11) and it seemed to work. System Details: Device name -PC Processor Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz 2.00 GHz Installed RAM 64.0 GB System type 64-bit operating system, x64-based processor Pen and touch No pen or touch input is available for this display Edition Windows 11 Pro Version 21H2 Installed on ‎7/‎4/‎2022 OS build 22000.739 Experience Windows Feature Experience Pack 1000.22000.739.0 Running the command I *think* worked? But I'm basing that of the fact nothing crashed: ![image.png](https://archive.blender.org/developer/F13308368/image.png) A curious thing to note however, is that blender *is* installed on my computer, however It doesn't appear to be in my path: ![image.png](https://archive.blender.org/developer/F13308365/image.png)
Author
Owner

That's perfect, that means that it works. Doesn't explain why it doesn't work on my laptop though :/

That's perfect, that means that it works. Doesn't explain why it doesn't work on my laptop though :/
Author
Owner

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sybren A. Stüvel self-assigned this 2022-08-01 16:05:25 +02:00
Author
Owner

This has been fixed in 642ef36778.

This has been fixed in 642ef36778.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: studio/flamenco#99438
No description provided.