wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

Windows 11 cannot build map #1036

Closed LLRukia closed 2 years ago

LLRukia commented 2 years ago

I am trying to build the map with wurst code, but I got these error below. It seems that the problem is cause of

Speaking of Dev channel builds, the WMIC tool has been already removed from Windows 11 build 22483 or higher.

compiler logs

2021-10-29 01:09:59 [pool-2-thread-1] INFO  n.m.wc3libs.bin.GameExe - Querying E:\Warcraft III Frozen Throne\Warcraft III.exe with dorkbox PE 
2021-10-29 01:09:59 [pool-2-thread-1] INFO  n.m.wc3libs.bin.GameExe - Falling back to WMIC due to {} 
java.lang.NullPointerException: null
    at dorkbox.peParser.types.ResourceDirName.<init>(ResourceDirName.java:89)
    at dorkbox.peParser.headers.resources.ResourceDirectoryEntry.<init>(ResourceDirectoryEntry.java:71)
    at dorkbox.peParser.headers.resources.ResourceDirectoryHeader.<init>(ResourceDirectoryHeader.java:62)
    at dorkbox.peParser.PE.fromInputStream(PE.java:156)
    at dorkbox.peParser.PE.<init>(PE.java:76)
    at dorkbox.peParser.PE.getVersion(PE.java:284)
    at net.moonlightflower.wc3libs.bin.GameExe.getVersionString(GameExe.java:30)
    at net.moonlightflower.wc3libs.bin.GameExe.getVersion(GameExe.java:93)
    at de.peeeq.wurstio.utils.W3InstallationData.lambda$new$0(W3InstallationData.java:53)
    at java.base/java.util.Optional.flatMap(Optional.java:294)
    at de.peeeq.wurstio.utils.W3InstallationData.<init>(W3InstallationData.java:51)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.getBestW3InstallationData(MapRequest.java:388)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.<init>(MapRequest.java:77)
    at de.peeeq.wurstio.languageserver.requests.BuildMap.<init>(BuildMap.java:31)
    at de.peeeq.wurstio.languageserver.WurstCommands.buildmap(WurstCommands.java:93)
    at de.peeeq.wurstio.languageserver.WurstCommands.execute(WurstCommands.java:61)
    at de.peeeq.wurstio.languageserver.WurstWorkspaceService.executeCommand(WurstWorkspaceService.java:42)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

languageServer logs

2021-10-29 01:09:59 [pool-2-thread-1] INFO  languageServer - Game Executable from path: Optional[E:\Warcraft III Frozen Throne\Warcraft III.exe] 
2021-10-29 01:09:59 [pool-2-thread-1] ERROR languageServer - Error 
java.io.IOException: '"C:\WINDOWS\System32\Wbem\wmic.exe"' is not recognized as an internal or external command,
operable program or batch file.

    at net.moonlightflower.wc3libs.bin.GameExe.getVersionString(GameExe.java:60)
    at net.moonlightflower.wc3libs.bin.GameExe.getVersion(GameExe.java:93)
    at de.peeeq.wurstio.utils.W3InstallationData.lambda$new$0(W3InstallationData.java:53)
    at java.base/java.util.Optional.flatMap(Optional.java:294)
    at de.peeeq.wurstio.utils.W3InstallationData.<init>(W3InstallationData.java:51)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.getBestW3InstallationData(MapRequest.java:388)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.<init>(MapRequest.java:77)
    at de.peeeq.wurstio.languageserver.requests.BuildMap.<init>(BuildMap.java:31)
    at de.peeeq.wurstio.languageserver.WurstCommands.buildmap(WurstCommands.java:93)
    at de.peeeq.wurstio.languageserver.WurstCommands.execute(WurstCommands.java:61)
    at de.peeeq.wurstio.languageserver.WurstWorkspaceService.executeCommand(WurstWorkspaceService.java:42)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
2021-10-29 01:09:59 [pool-2-thread-1] INFO  languageServer - Parsed custom game version from executable: Optional.empty 
LLRukia commented 2 years ago

I have tried that download a WMIC.exe and paste it to SYSTEM32\Wbem and I got this: lang server log

2021-10-29 01:18:05 [pool-2-thread-1] INFO  languageServer - Game Executable from path: Optional[E:\Warcraft III Frozen Throne\Warcraft III.exe] 
2021-10-29 01:18:07 [pool-2-thread-1] ERROR languageServer - Error 
java.io.IOException: 
    at net.moonlightflower.wc3libs.bin.GameExe.getVersionString(GameExe.java:60)
    at net.moonlightflower.wc3libs.bin.GameExe.getVersion(GameExe.java:93)
    at de.peeeq.wurstio.utils.W3InstallationData.lambda$new$0(W3InstallationData.java:53)
    at java.base/java.util.Optional.flatMap(Optional.java:294)
    at de.peeeq.wurstio.utils.W3InstallationData.<init>(W3InstallationData.java:51)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.getBestW3InstallationData(MapRequest.java:388)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.<init>(MapRequest.java:77)
    at de.peeeq.wurstio.languageserver.requests.BuildMap.<init>(BuildMap.java:31)
    at de.peeeq.wurstio.languageserver.WurstCommands.buildmap(WurstCommands.java:93)
    at de.peeeq.wurstio.languageserver.WurstCommands.execute(WurstCommands.java:61)
    at de.peeeq.wurstio.languageserver.WurstWorkspaceService.executeCommand(WurstWorkspaceService.java:42)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
2021-10-29 01:18:07 [pool-2-thread-1] INFO  languageServer - Parsed custom game version from executable: Optional.empty 

compiler log

2021-10-29 01:18:05 [pool-2-thread-1] INFO  n.m.wc3libs.bin.GameExe - Querying E:\Warcraft III Frozen Throne\Warcraft III.exe with dorkbox PE 
2021-10-29 01:18:06 [pool-2-thread-1] INFO  n.m.wc3libs.bin.GameExe - Falling back to WMIC due to {} 
java.lang.NullPointerException: null
    at dorkbox.peParser.types.ResourceDirName.<init>(ResourceDirName.java:89)
    at dorkbox.peParser.headers.resources.ResourceDirectoryEntry.<init>(ResourceDirectoryEntry.java:71)
    at dorkbox.peParser.headers.resources.ResourceDirectoryHeader.<init>(ResourceDirectoryHeader.java:62)
    at dorkbox.peParser.PE.fromInputStream(PE.java:156)
    at dorkbox.peParser.PE.<init>(PE.java:76)
    at dorkbox.peParser.PE.getVersion(PE.java:284)
    at net.moonlightflower.wc3libs.bin.GameExe.getVersionString(GameExe.java:30)
    at net.moonlightflower.wc3libs.bin.GameExe.getVersion(GameExe.java:93)
    at de.peeeq.wurstio.utils.W3InstallationData.lambda$new$0(W3InstallationData.java:53)
    at java.base/java.util.Optional.flatMap(Optional.java:294)
    at de.peeeq.wurstio.utils.W3InstallationData.<init>(W3InstallationData.java:51)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.getBestW3InstallationData(MapRequest.java:388)
    at de.peeeq.wurstio.languageserver.requests.MapRequest.<init>(MapRequest.java:77)
    at de.peeeq.wurstio.languageserver.requests.BuildMap.<init>(BuildMap.java:31)
    at de.peeeq.wurstio.languageserver.WurstCommands.buildmap(WurstCommands.java:93)
    at de.peeeq.wurstio.languageserver.WurstCommands.execute(WurstCommands.java:61)
    at de.peeeq.wurstio.languageserver.WurstWorkspaceService.executeCommand(WurstWorkspaceService.java:42)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Frotty commented 2 years ago

this is more of a wc3libs issue than wurstscript. WMIC is just a fall back. The main question is why is the pe parser failing with:

java.lang.NullPointerException: null
    at dorkbox.peParser.types.ResourceDirName.<init>(ResourceDirName.java:89)

I don't have win11 to verify, but this might indicate a local setup issue, e.g. due to using E: drive.

LLRukia commented 2 years ago

Thanks for reply. Emmmm, I think my local setup is correct because wurst works well several days ago. But after I upgrade to latest Windows 11, it was broken. I have found this issue about PeParser ResourceType lookup invalid ordinal NPE. So I am wondering whether it always fell back to WMIC before. And can we just go pass this calling?

LLRukia commented 2 years ago

I found the log before I upgrade Windows and it shows that my compiler did always fall back to WMIC. So the problem is why the WMIC fall back code doesn't work on my PC.

LLRukia commented 2 years ago

I have sloved this problem:

  1. Move Warcraft III.exe and Frozen Throne.exe out of my war3 install directory.
  2. Try again.
  3. The pe parser can parse the war3.exe successfully.