go: runtime: avoid functions forbidden on Windows 10 UWP
What version of Go are you using (go version)?
go version go1.9 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\maxr\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\maxr\AppData\Local\Temp\go-build474350779=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
What did you do?
-
Created static library with func defined in Go and exported to be used in C++ Command line:
go build -buildmode=c-archive puregodll.go -
Linked
puregodll.astatic library generated on previous step into the shared MinGW dll library. Command line:
gcc -dumpspecs | sed -e 's/-lmingwex/-lwinstorecompat -lmingwex -lwinstorecompat -lole32 -lruntimeobject/' >./specfile
gcc -specs=./specfile -shared -o goDLL.dll goDLL.c -Wl,--dynamicbase -Wl,--whole-archive puregodll.a -Wl,--no-whole-archive -lWinMM -lntdll -lWS2_32 -lsetupapi
It produces goDLL.dll as result.
-
Running script to adjust binary PE header of produced
goDLL.dllto be compatible with Windows 10 UWP platform (it expectsappcontainerbit set in PE header) -
Created Windows 10 UWP project with latest Visual Studio 2017 and P/Invoke
goDLL.dllto call func initially defined inpuregodll.go -
Run Windows Store Certification Kit for
Supported APIs Teston generated Windows Store appx bundle and getting list of forbidden API calls, it seems, used in go-runtime:
API AddVectoredExceptionHandler in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API ExitProcess in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API FreeEnvironmentStringsW in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API GetConsoleMode in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API GetEnvironmentStringsW in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API GetProcessAffinityMask in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API GetStdHandle in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API LoadLibraryA in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API RtlAddFunctionTable in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API RtlCaptureContext in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API RtlVirtualUnwind in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API SetConsoleCtrlHandler in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API SetProcessPriorityBoost in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API VirtualAlloc in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API WriteConsoleW in kernel32.dll is not supported for this application type. goDLL.dll calls this API.
API timeBeginPeriod in winmm.dll is not supported for this application type. goDLL.dll calls this API.
API timeEndPeriod in winmm.dll is not supported for this application type. goDLL.dll calls this API.
What did you expect to see?
I expect to have a way for go runtime to not use API calls which are forbidden on Windows 10 UWP platform
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 10
- Comments: 16 (6 by maintainers)
Hello @alexbrainman , It seems that support of UWP will require extending Go with new GOARCH. I’m planning to start adding of “windows_amd64_uwp” GOARCH support. Going to start looking into extending of
src\cmd\distbootstrap tool with new UWP arch.