可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm trying to compile the open source project Programmer Dvorak. The problem is that it's a bit old and doesn't build with the current versions of the build tools.
You can see the full source code with modifications I made online at my project's Google Code page. Revision 2 is the unmodified source files from the original project. Revision 3 is where I made all the significant changes. You can see a diff between the two revisions here.
The only obvious problems that are left are a few LINK warnings:
- LNK4254 (e.g.
section '.edata' (40000040) merged into '.data' (C0000040) with different attributes.
) -- I asked a stand-alone version of the question here.
- LNK4210 (e.g.
.CRT section exists; there may be unhandled static initializers or terminators
)
How do I fix these warnings? Can I ignore them?
Despite these warnings, it still produces an exe. If I go ahead and run it, though, it doesn't get installed correctly and I need to resort to a system restore in order to install the official version again.
This might be because of the warnings or simply because I didn't modify the project correctly.
What else do I need to do to make this project installable?
The build process (and an explanation of my modifications):
It says that you need the Windows DDK, but it seems like the Windows Driver Kit has replaced it, so I got that instead. I only installed the "Build Environments".
1. According to Readme.txt
, you are supposed to run:
build-layout && build-installer
2. build-layout.bat
is run.
I had to modify this file (see the diff here):
WinDDK
path was modified since I have a newer version (MOD-1).
set PATH=
... %WINDDK%\bin\x86\x86;
was added since link.exe
is located there (MOD-2).
- In
set INCLUDE=
, %WINDDK%\inc\wxp
was changed to %WINDDK%\inc\api
, because the wxp
folder does not exist, and my best guess is that the api
folder was needed since it contains kbd.h
, which kbddvp.c
uses (MOD-3).
- For
set LIB=
, %WINDDK%\lib\crt
was modified to %WINDDK%\lib\crt\i386
, so that libcmt.lib
could be found. See MOD-7 below. (MOD-4)
3. fkbddvp.mak
is run.
I had to modify this file (see the diff here):
- The path for the variable
CL32
was changed from $(WINDDK)\bin\x86\cl.exe
to $(WINDDK)\bin\x86\x86\cl.exe
, the first .exe doesn't exist, I believe this is the .exe I'm supposed to use instead. (MOD-5)
- The path for the variable
CL64
was changed from $(WINDDK)\bin\win64\x86\amd64\cl.exe
to $(WINDDK)\bin\x86\amd64\cl.exe
, this is my best guess as to where the missing .exe is. (MOD-6)
-opt:nowin98
removed to suppress warning LNK4224 (i.e. /OPT:NOWIN98 is no longer supported
), as suggested by Bobby. (MOD-10)
- Instead of using the non-existent
libc.lib
, I'm using libcmt.lib
. I read this post which recommends using this file instead. (MOD-7)
- Instead of using the obsolete utility
cabarc
, I'm using makecab
with makecab-dir.ddf
. I took my best guess as to how to execute the same logic with this new utility. (MOD-8)
4. build-installer.bat
is run.
I had to modify this file (see the diff here):
- This was also using
cabarc
and I modified it to use makcab
, similar to MOD-8, except that here it creates the .ddf file programmaticaly. (MOD-9)
The complete output
Here's the complete output, if you want to see it:
>build-layout && build-installer
"C:\WinDDK\7600.16385.1\bin\x86\x86\cl.exe" -nologo -c -I..\inc -Zp8 -Gy
-W3 -WX -Gz -Gm- -EHs-c- -GR- -GF -Zl -Oxs -D_WIN32_WINNT=0x0501 -Fokbddvp32.o
bj kbddvp.c
kbddvp.c
rc kbddvp.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6908.0
Copyright (C) Microsoft Corporation. All rights reserved.
link -machine:ix86 -nologo -dll -base:0x5FFF0000 -subsystem:native -def:
kbddvp.def -noentry -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data
-merge:.bss=.data -ignore:4078,4070 -section:.data,re -stack:0x40000,0x1000 -op
t:ref,icf -release -out:kbddvp32.dll kbddvp32.obj kbddvp.res
Creating library kbddvp32.lib and object kbddvp32.exp
LINK : warning LNK4254: section '.edata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.rdata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.text' (60000020) merged into '.data' (C0000040
) with different attributes
LINK : warning LNK4254: section '.bss' (C0000080) merged into '.data' (C0000040)
with different attributes
"C:\WinDDK\7600.16385.1\bin\x86\amd64\cl.exe" -nologo -c -I..\inc -Zp8 -
Gy -W3 -WX -Gz -Gm- -EHs-c- -GR- -GF -Zl -Oxs -DBUILD_WOW6432 -D_WIN32_WINNT=0x
0501 -Fokbddvp64.obj kbddvp.c
kbddvp.c
link -machine:amd64 -nologo -dll -base:0x5FFE0000 -subsystem:native -def
:kbddvp.def -noentry -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data
-merge:.bss=.data -ignore:4078,4070 -section:.data,re -stack:0x40000,0x1000 -o
pt:ref,icf -release -out:kbddvp64.dll kbddvp64.obj kbddvp.res
Creating library kbddvp64.lib and object kbddvp64.exp
LINK : warning LNK4254: section '.edata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.rdata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.text' (60000020) merged into '.data' (C0000040
) with different attributes
LINK : warning LNK4254: section '.bss' (C0000080) merged into '.data' (C0000040)
with different attributes
"C:\WinDDK\7600.16385.1\bin\x86\x86\cl.exe" -nologo -c -Folauncher.obj l
auncher.c
launcher.c
link -machine:ix86 -nologo -subsystem:windows -release -nodefaultlib -ou
t:launcher.exe launcher.obj kernel32.lib libcmt.lib user32.lib shell32.lib
libcmt.lib(cpu_disp.obj) : warning LNK4210: .CRT section exists; there may be un
handled static initializers or terminators
makecab /F makecab-dir.ddf
Microsoft (R) Cabinet Maker - Version 5.1.2600.5512
Copyright (c) Microsoft Corporation. All rights reserved..
27,686 bytes in 4 files
Total files: 4
Bytes before: 27,686
Bytes after: 8,140
After/Before: 29.40% compression
Time: 0.19 seconds ( 0 hr 0 min 0.19 sec)
Throughput: 144.58 Kb/second
iexpress /N /Q /M kbddvp.sed
1 file(s) copied.
Microsoft (R) Cabinet Maker - Version 5.1.2600.5512
Copyright (c) Microsoft Corporation. All rights reserved..
60,290 bytes in 16 files
Total files: 16
Bytes before: 60,290
Bytes after: 16,876
After/Before: 27.99% compression
Time: 0.27 seconds ( 0 hr 0 min 0.27 sec)
Throughput: 221.34 Kb/second
回答1:
AMD64? I think that is the issue there.
Perhaps the problem is just a matter of you using BOTH the files for 32 or 64 ISA at the same time.
Like:
kbddvp32.dll
kbddvp64.dll
Try using the ones for your platform ISA and take out the rest.
回答2:
MSDN links:
http://msdn.microsoft.com/en-us/library/ms235500(VS.80).aspx -- LNK4254
http://msdn.microsoft.com/en-us/library/708by912(VS.71).aspx -- LNK4210
Note: LNK4210 can be caused by -NOENTRY but only your code can tell is using it is right or wrong
LNK4254 is most probalby a "poltical" warning (a section declared as "read only" in a new version of some lib)
And I assume that you are running 2 completely clean and separated builds for x86 and x64. If not, you have to do that no matter what and do it first. So called mixed builds result in all kids of random-looking failures and there's noting to fix there - just have to build separately.
回答3:
I've merged sections before (had to, for what we were doing). It can get tricky, and I think one of the problems we had has bitten you too: you're merging the .text
section (which contains executable code) into the .data
section (which doesn't). The .data
section doesn't get the executable bit, and the /SECTION linker option (which should be able to force it to be executable) apparently doesn't work on .data
.
The way we worked around it is to create a new section, then merge all of the others into it. Here's how:
In one of your *.cpp files, add the following lines after your #include lines:
#pragma comment(linker, "/section:.merged,ERW")
#pragma code_seg(".merged")
(The second line has to be above some actual code, to create the new section.)
Then change the -merge:
commands to go to a new .merged
section instead of the .data
section...
-merge:.edata=.merged -merge:.rdata=.merged -merge:.text=.merged -merge:.bss=.merged
...and add a new one to put the .data
section there too:
-merge:.data=.merged
That should do the trick. You'll still get some warnings about the sections having different attributes, but you should be able to ignore them now (we suppress them by using /ignore:4254
on the linker). The final .merged
section will have executable, read, and write permissions, which will eliminate the problem.
(Our code is compiled with MSVC2005, but this should work in later ones too.)
回答4:
You'll notice that the source of where all these command line parameters came from is http://levicki.net/articles/tips/2006/09/29/HOWTO_Build_keyboard_layouts_for_Windows_x64.php. The reason it was used was that KLC 1.3 did not support 64 bit operating systems. KLC 1.4, added support for 64 bit operating systems. That means that if you can get away with creating a layout using KLC that supports all of the features you want, you should use that instead.
If, however, you need more advanced features and would like to compile these files yourself, you need to find out the new utilities and parameters that are used for KLC 1.4. The ones you have listed are outdated and meant for KLC 1.3.
I used Process Monitor to figure out which utilities are run, and what command line parameters are sent to them. Here they are, in the order they are run:
"C:\Program Files\Microsoft Keyboard Layout Creator 1.4\bin\i386\kbdutool.exe" -n -x -u ..\.\tmpYourKeyboard.txt
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs YourKeyboard.c
C:\PROGRA~1\MICROS~1.4\bin\i386\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs YourKeyboard.c
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text -MACHINE:IX86 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\i386 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text -MACHINE:IX86 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\i386 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
cvtres /machine:x86 /nologo /out:"C:\DOCUME~1\User\LOCALS~1\Temp\lnk1F.tmp" /readonly "YourKeyboard.res"
"C:\Program Files\Microsoft Keyboard Layout Creator 1.4\bin\i386\kbdutool.exe" -n -i -u ..\.\tmpYourKeyboard.txt
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\IA64\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs YourKeyboard.c
C:\PROGRA~1\MICROS~1.4\bin\i386\IA64\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs YourKeyboard.c
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.srdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text /MACHINE:IA64 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\ia64 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.srdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text /MACHINE:IA64 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\ia64 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
cvtres /machine:ia64 /nologo /out:"C:\DOCUME~1\User\LOCALS~1\Temp\lnk20.tmp" /readonly "YourKeyboard.res"
"C:\Program Files\Microsoft Keyboard Layout Creator 1.4\bin\i386\kbdutool.exe" -n -m -u ..\.\tmpYourKeyboard.txt
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\amd64\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs YourKeyboard.c
C:\PROGRA~1\MICROS~1.4\bin\i386\amd64\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs YourKeyboard.c
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text -MACHINE:AMD64 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\amd64 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text -MACHINE:AMD64 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\amd64 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
cvtres /machine:amd64 /nologo /out:"C:\DOCUME~1\User\LOCALS~1\Temp\lnk21.tmp" /readonly "YourKeyboard.res"
"C:\Program Files\Microsoft Keyboard Layout Creator 1.4\bin\i386\kbdutool.exe" -n -o -u ..\.\tmpYourKeyboard.txt
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs -DBUILD_WOW6432 -D_WOW6432_ YourKeyboard.c
C:\PROGRA~1\MICROS~1.4\bin\i386\cl.exe -nologo -IC:\PROGRA~1\MICROS~1.4\inc -DNOGDICAPMASKS -DNOWINMESSAGES -DNOWINSTYLES -DNOSYSMETRICS -DNOMENUS -DNOICONS -DNOSYSCOMMANDS -DNORASTEROPS -DNOSHOWWINDOW -DOEMRESOURCE -DNOATOM -DNOCLIPBOARD -DNOCOLOR -DNOCTLMGR -DNODRAWTEXT -DNOGDI -DNOKERNEL -DNONLS -DNOMB -DNOMEMMGR -DNOMETAFILE -DNOMINMAX -DNOMSG -DNOOPENFILE -DNOSCROLL -DNOSERVICE -DNOSOUND -DNOTEXTMETRIC -DNOWINOFFSETS -DNOWH -DNOCOMM -DNOKANJI -DNOHELP -DNOPROFILER -DNODEFERWINDOWPOS -DNOMCX -DWIN32_LEAN_AND_MEAN -DRoster -DSTD_CALL -D_WIN32_WINNT=0x0500 /DWINVER=0x0500 -D_WIN32_IE=0x0500 /MD /c /Zp8 /Gy /W3 /WX /Gz /Gm- /EHs-c- /GR- /GF -Z7 /Oxs -DBUILD_WOW6432 -D_WOW6432_ YourKeyboard.c
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\PROGRA~1\MICROS~1.4\bin\i386\rc.exe -r -iC:\PROGRA~1\MICROS~1.4\inc -DSTD_CALL -DCONDITION_HANDLING=1 -DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0500 /DWINVER=0x0400 -D_WIN32_IE=0x0400 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -DFPO=1 -DNDEBUG -l 409 YourKeyboard.rc
C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text -MACHINE:IX86 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\i386 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
C:\PROGRA~1\MICROS~1.4\bin\i386\link.exe -nologo -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re -MERGE:_PAGE=PAGE -MERGE:_TEXT=.text -MACHINE:IX86 -SECTION:INIT,d -OPT:REF -OPT:ICF -IGNORE:4039,4078 -noentry -dll -libpath:C:\PROGRA~1\MICROS~1.4\lib\i386 -subsystem:native,5.0 -merge:.rdata=.text -PDBPATH:NONE -STACK:0x40000,0x1000 /opt:nowin98 -osversion:4.0 -version:4.0 /release -def:YourKeyboard.def YourKeyboard.res YourKeyboard.obj
cvtres /machine:x86 /nologo /out:"C:\DOCUME~1\User\LOCALS~1\Temp\lnk22.tmp" /readonly "YourKeyboard.res"
回答5:
The linked source code is missing the sources.inc file which makes it difficult to get this built with a recent version of the WDK. The included .bat files are quite useless, they can only work on the author's machine. I got a clean build using the following steps with WDK version 6001.18002:
- unzip the .cab file to c:\temp\dvorak
- navigate to WDK's src\input\layout folder
- copy the sources.inc file to c:\temp
- edit kbddvp.c and comment the #define WIN32_LEAN_AND_MEAN directive
- Start + All Programs, Windows Driver Kits, WDK xxx.xxx, Build Environments, Windows Vista, blabla x86 free. Pick your own here.
- cd c:\temp\dvorak
- nmake
Doesn't take long, clean build. No actual test, being equipped with two left hands.
The sources.inc file you need:
INCLUDES=..\..\inc
C_DEFINES=
UMTYPE=nt
UMBASE=0x1000000
TARGETLIBS=
DLLDEF=$(TARGETNAME).def
!if $(IA64)
SECTION_ALIGNMENT=0x4000
!endif
LINKER_FLAGS = -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data -merge:.bss=.data -section:.data,re
LINKER_FLAGS= $(LINKER_FLAGS) /ignore:4254
NO_RDATA_MERGE=1
TARGETTYPE=DYNLINK
USE_NOLIBS=1
BUFFER_OVERFLOW_CHECKS=0
SOURCES=$(TARGETNAME).c $(TARGETNAME).rc
回答6:
launcher
is a program to start an elevated installation of the .inf file,
disabling redirection so that the true %SystemRoot%
directory is revealed
to a 32-bit process even if it is running in Wow64.
The only routine from the C runtime which it uses is ZeroMemory
, which is
a macro expanding to _memset
. In earlier versions, there was no problems
in linking this one routine statically, ignoring the runtime initialization.
Perhaps it is in later versions, which triggers the LNK4210 warning.
You can replace the calls to ZeroMemory
with this function:
void ZeroFill(IN VOID UNALIGNED *ptr, IN SIZE_T len) {
char *dst;
for( dst = (char*) ptr; len > 0; len--, dst++) {
*dst = 0;
}
}
and remove the reference to libc
/libcmt
and the directory %WINDDK%\lib\crt\i386
.
Note also that if you as an Administrator choose Install from the context-menu
in Explorer for the kbddvp.inf
file, you should be able to do the setup
without the launcher
program, thus eliminating any errors from that stage. It
is only present for easier redistribution and is not vital.
回答7:
As of version 1.2.6 the layout can also be built using the Visual Studio 2013 Community Edition Update 4, on a Windows 7 64-bits machine.