- 
                Notifications
    
You must be signed in to change notification settings  - Fork 18.4k
 
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.20 windows/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
    :
GOARCH=amd64
GOOS=windows
    :
What did you do?
Some of the Windows system dynamic link library (DLL) files have extensions other than .dll.
For example,
- ActiveX Controls files with 
.ocxextension - Control Panel applets with 
.cplextension - Device drivers with 
.drvextension 
mkwinsyscall does not support generating the syscall wrappers for these DLLs with different extensions.
The extension is always hard-coded to .dll in the generated code.
//sys ClosePrinter(h syscall.Handle) (err error) = winspool.ClosePrinter
What did you expect to see?
var (
        modwinspool = windows.NewLazySystemDLL("winspool.drv")
        procClosePrinter = modwinspool.NewProc("ClosePrinter")
)
What did you see instead?
var (
        modwinspool = windows.NewLazySystemDLL("winspool.dll")
        procClosePrinter = modwinspool.NewProc("ClosePrinter")
)
Proposed solution
If the user specified the extension of the DLL in the //sys comment, use that extension instead of adding the .dll extension.
Going back to the previous example, the user can specify the extension as .drv in the //sys comment.
//sys ClosePrinter(h syscall.Handle) (err error) = winspool.drv.ClosePrinter
Then, the generated code will be,
var (
        modwinspool = windows.NewLazySystemDLL("winspool.drv")
        procClosePrinter = modwinspool.NewProc("ClosePrinter")
)
The code changes are fairly straightforward. I have working code that I can submit as a pull request if the proposal makes sense.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Type
Projects
Status
Todo