Closed chaoqwu closed 11 months ago
You'll need to contact the author of javafloppywrapper.dll - they have an error occuring in that native DLL which is then propagating back through Java
javafloppywrapper.dll
Hi, how to find the author of "javafloppywrapper.dll ". I thought you are the author
where did you install jviewer from?
Jviewer was installed automatically when i installed Java which was downloaded from Nokia software center:
@chaoqwu OK in that case you need to contact Nokia as they are packaging a version of our binary with IcedTea web
OK. Fine. It's stuck here. Nokia IT is not responsible for 3rd party software issue. Ping-pong happens.
@chaoqwu Ask the Nokia support staff to contact us if required but the error is happening in their software component
@karianna I will talk with them.
@chaoqwu try to install 32bit java. It helps me on Windows 10 LTSC
It has bug in windows x64 version, you can use my patch script:
#! /usr/bin/env python3
# Rather than try javaws, lets just download the jars and run them locally
import logging
import os
import platform
import re
import subprocess
import tempfile
import urllib.parse
import zipfile
import argparse
import requests
# from requests.packages.urllib3.exceptions import InsecureRequestWarning
# requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
MAIN_CLASS = "com.ami.kvm.jviewer.JViewer"
# Follow redirects probably to a https website and then use https rather than http
def scheme_test(server):
r = requests.get(url=("http://{svr}".format(svr=server)), verify=False)
return urllib.parse.urlparse(r.url).scheme
# Download the 3 files that are needed. Always named the same, so no
# need to parse jnlp xml
def download_jars(tmpdir: str, scheme: str, ip: str):
system = platform.system()
if system == "Linux":
natives = "Linux_x86_"
elif system == "Windows":
natives = "Win"
elif system == "Darwin":
natives = "Mac"
else:
raise Exception("OS not supported: " + system)
natives += platform.architecture()[0][:2] + ".jar"
for jar in ["JViewer.jar", "JViewer-SOC.jar", natives]:
jar_path = os.path.join(tmpdir, jar)
jar_url = f'{scheme}://{ip}/Java/release/{jar}'
r = requests.get(jar_url, verify=False)
# r.raise_for_status()
with open(jar_path, "wb") as f:
logging.info(f"downloading {jar_url} -> {jar_path}")
f.write(r.content)
if jar == natives:
logging.debug(f"extracting {jar_path}")
try:
with zipfile.ZipFile(jar_path, "r") as natives_jar:
natives_jar.extractall(path=tmpdir)
except zipfile.BadZipFile:
logging.error(f"NO NATIVE LIBS FOUND FOR {jar}")
new_magic_bytes = bytes.fromhex('48 8b 03 45 8b cb'.replace(' ', ''))
new_new_bytes = bytes.fromhex('48 8b 03 4d 89 d9'.replace(' ', ''))
delete_magic_bytes = bytes.fromhex('8b d8 8b c8'.replace(' ', ''))
delete_new_bytes = bytes.fromhex('50 5b 50 59'.replace(' ', ''))
open_magic_bytes = bytes.fromhex('8b c8 45 33'.replace(' ', ''))
open_new_bytes = bytes.fromhex('48 91 45 33'.replace(' ', ''))
close_magic_bytes = bytes.fromhex('8b c8 48 8b 01'.replace(' ', ''))
close_new_bytes = bytes.fromhex('48 91 48 8b 01'.replace(' ', ''))
list_get_version_magic_bytes = bytes.fromhex('8b c8 48 8d 54'.replace(' ', ''))
list_get_version_new_bytes = bytes.fromhex('48 91 48 8d 54'.replace(' ', ''))
execute_magic_bytes = bytes.fromhex('8b f8 48 8b 06'.replace(' ', ''))
execute_new_bytes = bytes.fromhex('50 5f 48 8b 06'.replace(' ', ''))
execute_cdrom_magic_bytes = bytes.fromhex('8b d8 48 8b 07'.replace(' ', ''))
execute_cdrom_new_bytes = bytes.fromhex('50 5b 48 8b 07'.replace(' ', ''))
if system == 'Windows':
for dll in ['javacdromwrapper', 'javafloppywrapper', 'javaharddiskwrapper']:
with open(f'{tmpdir}/{dll}.dll', 'rb+') as f:
data = f.read()
f.seek(0, 0)
assert(data.count(new_magic_bytes) == 1)
data = data.replace(new_magic_bytes, new_new_bytes)
assert(data.count(delete_magic_bytes) == 1)
data = data.replace(delete_magic_bytes, delete_new_bytes)
assert(data.count(open_magic_bytes) == 1)
data = data.replace(open_magic_bytes, open_new_bytes)
assert(data.count(close_magic_bytes) == 1)
data = data.replace(close_magic_bytes, close_new_bytes)
if dll == 'javaharddiskwrapper':
assert(data.count(list_get_version_magic_bytes) == 3)
else:
assert(data.count(list_get_version_magic_bytes) == 2)
data = data.replace(list_get_version_magic_bytes, list_get_version_new_bytes)
if dll != 'javacdromwrapper':
assert(data.count(execute_magic_bytes) == 1)
data = data.replace(execute_magic_bytes, execute_new_bytes)
else:
assert(data.count(execute_cdrom_magic_bytes) == 1)
data = data.replace(execute_cdrom_magic_bytes, execute_cdrom_new_bytes)
f.write(data)
# input()
def run_jviewer(tmpdir: str, scheme: str, ip: str, username: str, password: str):
session = requests.session()
login_res = session.post(f"{scheme}://{ip}/rpc/WEBSES/create.asp", data={"WEBVAR_USERNAME": username, "WEBVAR_PASSWORD": password})
match = re.search("'SESSION_COOKIE' : '([a-zA-Z0-9]+)'", login_res.text)
assert(match)
session_cookie = match.group(1)
session.cookies.update({'SessionCookie': session_cookie})
jnlp_request = session.get(f'{scheme}://{ip}/Java/jviewer.jnlp?EXTRNIP={ip}&JNLPSTR=JViewer', stream=True)
jnlp_data = b''
try:
for data in jnlp_request.iter_content(chunk_size=1):
jnlp_data += data
except requests.exceptions.ChunkedEncodingError as ex:
pass
jnlp_path = f'{tmpdir}/jviewer.jnlp'
with open(jnlp_path, "wb") as jnlpfile:
jnlpfile.write(jnlp_data)
args = [
f"java",
f"-Djava.library.path={tmpdir}",
"-cp",
os.path.join(tmpdir, "*"),
MAIN_CLASS,
]
args += re.findall(
"<argument>([^<]+)", jnlp_data.decode()
) # Fixes some machines that use malformed xml
logging.info(" ".join(args))
subprocess.run(args)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser(
prog='jviewer-starter',
description='jviewer-starter')
parser.add_argument('ip')
parser.add_argument('username')
parser.add_argument('password')
args = parser.parse_args()
ip = args.ip
scheme = scheme_test(ip)
with tempfile.TemporaryDirectory(prefix="jviewer-starter") as td:
download_jars(td, scheme, ip)
run_jviewer(td, scheme, ip, args.username, args.password)
Please provide a brief summary of the bug
Java window is unexpectedly closed automatically when clicking "virtual media wizard"
Please provide steps to reproduce where possible
No response
Expected Results
window not closed
Actual Results
window closed automatically
What Java Version are you using?
openjdk version "1.8.0_392" OpenJDK Runtime Environment (Temurin)(build 1.8.0_392-b08) OpenJDK 64-Bit Server VM (Temurin)(build 25.392-b08, mixed mode)
What is your operating system and platform?
windows 64bit
How did you install Java?
i get it from company own Software Center
Did it work before?
Did you test with the latest update version?
Did you test with other Java versions?
Relevant log output