Install Winhlp32 (32bit Winhelp) on Windows 10

By dose | February 18, 2021
Under: Uncategorized
Comments: No Comments »

As I recently got asked on how to install WinHlp32.exe on Windows 10, I once wrote a little script to automate the task that I share here, as Microsoft fails to provide an installer for it on Windows 10.

Just copy the following lines into a file called install_winhelp.cmd and then execute it, it should download and install winhlp32.exe automatically:

@echo off
setlocal
echo Detecting language...
set LANG=%1
if "%1"=="" for /f "delims=" %%a in ('powershell.exe -ExecutionPolicy ByPass -Command "$PSUICulture"') DO set "LANG=%%a"
if "%LANG%"=="" set LANG=de-de
 
rem Ensure that we are run from 64bit prompt
if "%ProgramFiles(x86)%" == "" goto StartExec
if not exist %SystemRoot%\Sysnative\cmd.exe goto StartExec
%SystemRoot%\Sysnative\cmd.exe /C "%~f0" %*
exit /b
:StartExec
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
  echo Requesting administrative privileges...
  goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
 
set ARCH=amd64
reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | Find /i "x86" >nul
if not errorlevel 1 set ARCH=x86
 
echo Downloading Winhelp, using language %LANG% for arch %ARCH%...
bitsadmin /transfer Windows8.1-KB917607-x64.msu /download /priority normal https://download.microsoft.com/download/A/5/6/A5651A53-2487-43C6-835A-744EB9C72579/Windows8.1-KB917607-x64.msu %CD%\Windows8.1-KB917607-x64.msu
if not exist Windows8.1-KB917607-x64.msu goto fini
 
md ContentMSU
expand Windows8.1-KB917607-x64.msu /F:* .\ContentMSU
 
cd ContentMSU
md ContentCAB
expand Windows8.1-KB917607-x64.cab /F:* .\ContentCAB
 
cd ContentCAB
cd %ARCH%*winhstb*%LANG%*
if not exist winhlp32.exe.mui (
  echo winhlp32.exe.mui does not exist in requested langauge
  goto fini
)
takeown /f "%SystemRoot%\%LANG%\winhlp32.exe.mui"
icacls "%SystemRoot%\%LANG%\winhlp32.exe.mui" /grant "%UserName%":F
ren %SystemRoot%\%LANG%\winhlp32.exe.mui winhlp32.exe.mui.w10
copy /y winhlp32.exe.mui %SystemRoot%\%LANG%\winhlp32.exe.mui 
cd ..
cd %ARCH%*winhstb*none*
if not exist winhlp32.exe (
  echo winhlp32.exe does not exist ??
  goto fini
)
takeown /f "%SystemRoot%\winhlp32.exe"
icacls "%SystemRoot%\winhlp32.exe" /grant "%UserName%":F
ren %SystemRoot%\winhlp32.exe winhlp32.exe.w10
copy /y winhlp32.exe %SystemRoot%\winhlp32.exe
cd ..\..\..
rmdir /s /q  ContentMSU
echo Done
 
:fini
endlocal
pause

Convert (Debrand and remove SIMlock) of Nokia E63 from carrier Drei to standard E63

By dose | January 5, 2021
Under: Uncategorized
Comments: No Comments »

I love phones with keyboards. The modern touchscreen based Smartphones may be useful for i.e. Internet surfing, but their on-screen keyboard without the ability to type with physical feedback from the buttons is just very, very awful and makes them barely usable for my purposes.
Therefore I love the old Nokia E63 Symbian S60v3-based phones. Its “killer feature” is the flashlight that can be toggled by just pressing the space bar, it’s so much easier than fiddling around with a touchscreen to turn it on. That’s one reason why I prefer it over the Nokia E71, and according to some reviews, the E72 isn’t that great either.
Now my E63 aged, some plastic parts fell out and after carrying the phone in my pocket on a very rainy day, the phone shut down and didn’t recover from the water incident for serveral days.
After drying it for a few days and opening it to let the wetness dry out, the phone recovered and started back normally. So generally, these devices seem to be very robust. But I noticed over time that the signal quality got worse. Sometimes that phone just disconnected from the cell tower and it took minutes to reconnect and so I got missed calls depending on my location. And I suddenly was unable to get a proper signal in areas where I had no problems to at least get a low signal level before. So due to the water, some component may unfortunately have degraded.
Time to get a replacement! These old phones with European style keyboards are getting rarer on the market, but the Austrian carrier “Drei” once gave out these phones and some of them are still around for a few bucks, but with Drei Simlock in place and the firmware is also branded. But as these are still easy to get, I bought a used one and had to remove the Drei Simlock and debrand it.
In case someone likes the E63 as much as I do and still wants to do this procedure today, here is a short howto:

For all operations, I used the Nokia BEST (BB5 Easy Service Tool) v. 1.51 by Infinity-Box Team

1. Prepare

I carried out all Operations on Windows XP, but I guess it may also work on Win 7.
1.1 Download Nokia BEST V 1.51 and install it to your work directory
1.2 Download Nokia USB driver and install it (also contains driver for Bootloader which is needed).

I also had Nokia PC Suite installed, but I guess it’s not really necessary. I just had it on my machine anyway.

2. Remove SIM-Lock

This video shows the process.
It may be a good idea to verify that the connetion to the phone works, therefore first let’s read it:
2.1 Power on the E63
2.2 Start Nokia BEST and connect USB cable between Nokia and PC, select “PC Suite” when asked on the phone in which mode you want to connect.
2.3 Noka BEST should now detect the phone and be able to read it. So under “Service Tool” tab, click “Read info”. On Lock status, you will see Lock  closed, type of your phone is PA_SL2 phone. If this applies, the phone is SIM-locked and you need to continue, otherwise it may already be unlocked.
2.4 Ensure that your phone has enough battery and unplug the charger, if you have plugged it in (I found the process easier with no charger attached). Go to “Repair” tab and click “Rd key”.
You will be presented with a dialog with instructions:
2.5 Unplug USB cable, shut down your hpone with the red Hangup key and wait till it is turned off.
2.6 Press OK in the dialog
2.7 Replug USB cable and press the red Hangup key for just about half of a second. Nokia BEST should detect the phone and read out data. Phone is booted into service mode.
2.8 When it shows “Key file updated”, then you can finally unlock it, go to tab “Unlock” and press “Unlock”.  Unlock should be done now and locks removed.

Don’t showdown or unplug cable yet to get out of service mode, you can do one more step to debrand phone on the next step:

3. Debrand phone

Change product code

First, you need to find out the production data of your current phone and the production data of the phone, you want to convert it to. Normally, this number can be found on a label under the battery in the field named “Code”, bot to see the real code, on Nokia BEST, go to tab “Service Tool” and in “Prduction Data Edit”, click “Read”.
To make sense of the number, there are lists of the production codes available, i.e. this list seems to be pretty complete.
Now in my example, the phone I want to debrand is a:

0583827 200.21.012 E63-1 RM-437 3 AT AT ULTRA BLUE GV

Now I need to find the product code for the phone that I want to turn it into. For the central European market with QWERTZ keyboard, this code is the correct one for my purposes:

0568835 RM-437 CTR EURO-C ALS ON Ultramarine 200.21.01

So, enter the code above in the input field and click “Write”.
“ALS ON” stands for “Ambient light sensor” activated, I think, which detects light conditions and handles keyboard light accordingly (the sensor is right next to the speaker).

Download firmware

Unfortuntely, Microsoft shut down the old update servers for the BB5 phone firmwares, but luckyly, some people have archived the complete firmware packages. See this thread on gsmhosting forum. Download the EURO firmware package (Nokia_E63_RM-437_EURO_DP_15.00_MCU_510.21.010.exe). Should it get lost somehow, The Internet Archive also has an archive of BB5 firmware packages.

After download, install the Firmware package and note down the path you installed it to. The directory contains a file named readme_euro.txt

Flash the firmware

Take note of the respective firmware flash files you need for the Product code that you changed the code to in the previous step. I.e. for out 0568835 phone, the readme_euro.txt tells us:

Transceiver: 0568835: RM-437 CTR EURO-C ALS ON Ultramarine
 Images:
 - rm437_510.21.010_prd.c00
 - rm437_510.21.010_prd.v33
 - rm437_510.21.010.42U
 - sofie_erase_y_drive.fpsx
 - RM437_ENO_008.07.45_100.71.952.a018.fpsx

Now go to Nokia BEST again to tab “Flashing”. Select phone Model (RM-437 in our case), and check the following boxes

[x] Use INI
[x] Manual
[x] Dead mode
[x] Backup
[x] Chk/Read
[x] Set Normal
[x] FactorySet

After previous step, I disconneted the phone, reboted it normally, checked that it still booted and then did the flash (you can leave local mode on phone my just pulling out the battery).
If you are doing this in one step, “Dead mode” checkbox may not be available. Not sure if flashing can be done in one step after SIM-unlocking.
Now select the respective files fro the README above for the Fields MCU, PPM1, CNT1, CNT2, CNT3 (leave out PPM2).
The process can be seen on this video.
Be aware that all data gets deleted from the phone!! Also ensure to remove an SD-Card from the phone, if you have one sitting in the phone.
Finally click “Flash” to flash the new firmware on the phone.
If you have previously disconnected the phone, you must follow the same procedure as in first step. Disconnect cable, power off phone, reconnect cable, press hangup for half of a second and let the flash process start.

After flashing is done, you should have a new stock firmware on the device.

4. Remove signature enforcement

The Nokia Symbian phones have the annoying feature that all software installed on the phone must be signed with a certificate. You can turn off the ceritficate verification, but it still checks the certificate date/timestamp and you cannot install unsigned software. In order to remove these limits, Installer needs to be patched.
This video shows you how to do it.
It is said that a memory card should be used to carry over the files and a SIM card needs to be inserted in order to work properly. Havent’t tried if this is really needed, but did so:

Copy Norton Symbian hack, RomPatcherPlus, X-Plore and installserver.exe to a directory on memory card.
Menu -> Office -> clock -> Change phone date to 01.01.2009
Menu -> Installations -> App mgr. -> Options -> Settings -> Software installation -> All
Menu -> Office -> File manager -> Memory card -> Install NortonSymbianHack.sisx
Menu -> Installations -> Norton -> Options -> Antivirus -> Quarantine list -> Options -> Restore all -> Yes
Menu -> Installations -> App mgr. -> Symantec Symbian Hack -> Options -> Remove -> Yes
Menu -> Office -> File manager -> Memory card -> Install RomPatcherPlus_3.1.sisx (Into Phone memory)
Menu -> Installations -> RomPatcher+ -> [x] Install Server RP+ (turns red) -> [X] Open4All RP+ (turns green)
Meno -> Office -> clock -> Change phone date to 01.01.2012
Menu -> Office -> File manager -> Memory card -> Install X-plore V.1.56 S60v3+v5+…
Menu -> Installations -> X-plore -> Menu -> tools -> configuration -> [x] Show system files/folders -> Back
Copy installserver.exe to C:\sys\bin

5. Install language pack for TTS (Text to Speech)

As the default language for Text-to-speech is only English, you need to install additional TTS-Langpacks. i.e. the German language pack can be found here.

 

Now I was able to install all applications from the old phone on the replacement phone, migrate data via Nokia PC Suite and finally got my replacement phone running as new main phone. Mission accomplished 🙂

In case some files linked here are missing (files are not available anymore), just drop me a comment and I can supply them to you.

Installing MS SQL Server 2019 on Devuan Beowulf (~Debian 10)

By dose | December 22, 2020
Under: Uncategorized
Comments: No Comments »

As this systemd plague has also caught Debian, I’m mostly using Devuan for new servers now to have the normal SYSV-Init system I’m used to.
I already wrote an article on how to install MS SQL Server 2017 on Debian Jessie. Now here is a little Tutorial on how to install it on lates Devuan Beowulf:

I assume you are root and fixed the annoying Debian 10 su bug with:

echo "ALWAYS_SET_PATH yes" >/etc/default/su
apt-get install gnupg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list | tee /etc/apt/sources.list.d/mssql-server.list
wget -qO- https://packages.microsoft.com/config/debian/10/prod.list | tee /etc/apt/sources.list.d/mssql-client.list
apt-get update
apt-get install mssql-server
/opt/mssql/bin/mssql-conf setup
# Ignore error about failed systemctl start after setup
vi /etc/init.d/mssql-server

# Insert script from http://hardwarefetish.com/781-ms-sql-server-2017-upstart-script

chmod +x /etc/init.d/mssql-server
update-rc.d mssql-server defaults
/etc/init.d/mssql-server start
apt-get install mssql-tools unixodbc

Pretty straightforward. No more messing around with openssl lib like on Jessie.

Converting a NetAPP SAS-drive (i.e. Seagate ST3300655SS) to a normal PC-Harddisk

By dose | December 22, 2020
Under: Uncategorized
Comments: No Comments »

Recently my boss discovered that he had some spare SAS 300GB drives which weren’t accepted by the Adaptec RAID Controller.
When trying to use them, the Adaptec RAID controller (8805) just showed that the drive is “currently not supported by the raid adapter” on bootup and refused to show the drive in its list. It showed drive name and Firmware version and is seems that these drives were made for NETAPP Storage appliance according to the Firmware version (also indicated by the Firmware NA01 on the drive’s label).
Now I found out that these drives seem to be formatted with 520 bytes sector size instead of the “classic” 512 byte, thus the RAID controller refused them.
To make them standard drives, I flashed Standard firmware on them, a step, that may not be necessary, but I did it anyway to ensure proper operation:

I first downlaoded a package containing SeaFlashLin, a little Linux distribution by Seagate that included their flash program and put it an a bootable USB stick by just running 
bootable tools/USBbootBuilder-16_Kernel4.3.0-SeaFlashLin-046.USBsetup.exe from the archive.
Next, I downloaded Standard firmware (Release 006) for the drive from HP, as none is available from Seagate’s website. HDDGURU also has a mirror of the needed 15K5_SAS0006.lod firmware file. I put the mentioned .lod file on the USB stick I created and booted it up.

I then flashed the drive with

seaflashlin -f 15K5_SAS0006.lod -d /dev/sgX

where /dev/sgX is the device node of the harddisk on the controller that gets shown in the list of the startup script (which basically just does seaflashlin -i).
After flashing the firmware, drive reset fails, but I just powered down the machine with poweroff command so that the drive gets reset.

Next, I booted up a USB stick with Knoppix Linux which contains the sg3_utils which are needed to reformat the drive with 512 byte Sector size.
One can verify the device node /dev/sgX where the drive is located by checking dmesg, as lsscsi command is not available in Knoppix per default. But it should usually be the same as before when the drive was flashed with new firmware. These drives seem to need a 6 byte command instead of 10 bytes, that’s why the –six parameter is needed. So as root:

 sg_format --format --size=512 --six /dev/sgX

In my case, the formatting was completed very quickly but it showed an error DID_NO_CONNECT when querying status before success-mssage. 
One can either wait a few hours until it is believed that the formatting is complete, or reformat the drive in the RAID controller’s menu. 
After that, the drive just worked fine in the RAID.

 

Fixing Kyocera fs-6021dn errors 7401 7402 7403 and 7404

By dose | June 4, 2020
Under: Uncategorized
Comments: No Comments »

At the office, we had a cheap Kyocera fs-6021dn. After a few years of use, the printer finally gave up with error 7403. Looking at the service manual, the error description is:

Developing unit M noninstalling error
No density detection signal is output from toner sensor M in developing unit M.
Possible causes:
 – Defective connector cable or poor contact in the connector.
 – Defective toner sensor M.
 – Defective engine PWB.

So I found a video showing the disassembly of the printer in order to find the drum developer transfer units. This video showed the removal of the toners and the transfer belt in order to find the drums. When I removed toner and transfer belt (which also wasn’t completely sane, but it seems that the defect found here didn’t really cause real problems for the printer), I found out that the contact of one of the drum units was loose. I just pushed it down so that the connector had contact again and tadaa – no more error 7403

Plötzlicher SCHANNEL Fehler von Outlook auf Win7 nach Let’s Encrypt Zertifikatswechsel

By dose | February 9, 2020
Under: Uncategorized
Comments: No Comments »

Hatte heute ein lästiges Problem. Habe SoGO mit EAS auf einem Server laufen, dessen Zertifikat von Let’s Encrypt ausgegeben und automatisch erneuert wird.
Seit der Zertifikatserneuerung heute war plötzlich eine Mailsynchronisation mehr möglich, Outlook zeigte immer nur “getrennt” an.

Im Ereignisprotokoll habe ich dann einen Haufen SCHANNEL Fehler gefunden, immer gleichlautend:

“Es wurde eine schwerwiegende Warnung empfangen: 40”

und auch:

“Es wurde eine schwerwiegende Warnung empfangen: 70”

Sehen wir uns also einmal die Fehlercodliste an:
SSL3_ALERT_HANDSHAKE_FAILURE  40
TLS1_ALERT_PROTOCOL_VERSION  70

Outlook dürfte also – vermutlich aufgrund des Zertifikatswechsels – aus irgendeinem Grund nicht mehr mit der bevorzugten SSL-Version mit dem Server kommunizieren können. Nach Prüfung der Liste der vom Server unterstützten TLS-Versionen kommt heraus, dass dieser nur TLS 1.2 angeboten hat. Dies wird jedoch wiederum standardmßig von Win7 WinHttp nicht unterstützt. Zum Glück hat mich dieser Artikel dann auf die richtige Spur gebracht: KB3140245. Das war zwar schon installiert, jedoch muss man noch 2 Registry-Schlüssel anlegen, um die Standards zu ändern:

Unter

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

und

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

(sofern 64bit Win7) einen DWORD-Wert namens DefaultSecureProtocols mit dem Hex-Wert 0xA80 anlegen, und schon funktioniert es wieder.

Der Grund für die plötzliche Umstellung dürfte übrigens sein, dass die Zertifikatserneuerung über certbot funktioniert, und dieser aktualisiert sich offensichtlich bei einer Erneuerung auch selbstständig und hat mit dann in der Datei /etc/letsencrypt/options-ssl-apache.conf folgende Zeile eingefügt/geändert:

SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

Damit wurden also dann fieserweise die alten TLS-Versionen einfach abgedreht.

Crack für Monkey Island 2 / Deutsch

By dose | February 5, 2020
Under: Uncategorized
Comments: 1 Comment »

Nachdem ich in einem Kommentar gefragt worden bin, wie man Monkey Island 2 crackt, geht’s weiter in der Serie von LucasArt Adventure cracks.
Wie auch bei Monkey Island 1 sind die files mit 0x69 verXORt.

Fehlerfall:

Script 130, offset 0x24f: [14] o5_print()
Script 130, offset 0x254: [14] o5_print()
Script 130, offset 0x259: [9A] o5_move()
Script 130, offset 0x25e: [88] o5_isNotEqual()
Script 130, offset 0x265: [14] o5_print()
Script 130, offset 0x276: [AE] o5_wait()

Erfolgsfall:

Script 130, offset 0x24f: [14] o5_print()
Script 130, offset 0x254: [14] o5_print()
Script 130, offset 0x259: [9A] o5_move()
Script 130, offset 0x25e: [88] o5_isNotEqual()
Script 130, offset 0x287: [2E] o5_delay()
Script 1, offset 0x96e: [68] o5_isScriptRunning()

Als die Kommandos in MONKEY2.001 ansehen (nachdem wir 0x69 XOR gemacht haben):

879289: 9A EA 01 03 40 88 06 02 ea 01 22 00

Warum steht hier 9A und nicht 1A für o5_move und 88 und nicht 08 für o5_isNotEqual?
Weil der Parameter (PARAM_1) als Variable genommen werden soll und nicht als Wert.
In Variable 1EA wird also der Wert von Variable 4003 eingefügt, anschließend wird verglichen, ob in Var 1EA der Wert von Var 206 steht, wenn ja, dann um 22 Bytes gesprungen.

Nachdem der Wert vielleicht später auch nochmal geprüft wird, moven wir einfach den korrekten Inhalt von Var 206 in var 1EA, indem wir also 4003 mit 206 ersetzen:

879289: 9A EA 01 06 02 88 06 02 ea 01 22 00

Das Ganze wieder mit 0x69 verXORen, fertig ist der Crack 🙂
 (Keine Garantie, dass er funktioniert, aber zumindest nimtm der Kopierschutz dann jede Eingabe an).
Jetzt könnt ihrs aber dann schon langsam alleine auch, oder? *gähn*

Mehrere JPG-Bilder in ein PDF konvertieren

By dose | November 5, 2019
Under: Uncategorized
Comments: No Comments »

Es kommt immer einmal wieder gerne vor, dass man – um sich die teuren Kopiergebühren zumindest temporär zu ersparen – Akten abfotografiert.
Hierbei kommen dann ein Haufen JPG Bilder zusammen in meistens unterschiedlichen Ausrichtungen: Mal kopfüber, mal richtig, mal quer, je nachdem, wie es das Tablet/Handy gerade für gut befindet.
Um die Bilder in die richtige Ausrichtung zu bringen und in ein PDF zu wandeln, habe ich mir eine kleine Batchdatei geschrieben, die dies erledigt.
Hierfür werden das kostenlose OCR-Programm Tesseract und das ebenfalls freie Tool jpegtran (für Seitenerkennung und Ausrichtung) genutzt.
jpegtran muss sich im Suchpfad befinden, dann kann man einfach ein Verzeichnis mit .jpg Dateien auf die .bat Datei ziehen und diese wird konvertiert:

@echo off
setlocal enableextensions
set PATH=%PATH%;C:\Program Files (x86)\Tesseract-OCR\
echo Drehe Seiten...
for %%I in ("%~1\*.jpg") do (
  for /F "tokens=2"  %%F in ('tesseract.exe --psm 0 "%%I" stdout ^| find "Rotate:"') do (
    echo %%I um %%F Grad
    if not "%%F"=="0" jpegtran -rotate %%F "%%I" "%%I"
  )
)
echo Erstelle OCR-PDF...
dir /s /b "%~1\*.jpg" | tesseract - "%~1\combined" -l deu pdf
endlocal

MS SQL Server 2017 upstart script

By dose | October 30, 2019
Under: Uncategorized
Comments: 2 Comments »

I recently had to install a MS SQL Server 2017 on Linux. Unfortunately, the supplied scripts only support the stupid systemd, not upstart, so for Devuan or Debian Jessie without systemd, the script may be benificial:

!/bin/sh
### BEGIN INIT INFO
# Provides: mssql-server
# Required-Start:       $syslog $local_fs $network.
# Required-Stop:        $syslog $local_fs $network.
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description: Microsoft SQL Server Database Engine
### END INIT INFO
 
DESC="Microsoft SQL Server Database Engine"
NAME=mssql-server
PIDFILE=/var/run/$NAME.pid
DAEMON="/opt/mssql/bin/sqlservr"
SCRIPTNAME=/etc/init.d/mssql-server
USER=mssql
 
. /lib/lsb/init-functions
 
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
 
case "$1" in
        start)
                log_daemon_msg "Starting $DESC" "$NAME"
                start-stop-daemon --start --quiet --oknodo --chdir /var/opt/mssql --background --make-pidfile --pidfile $PIDFILE --chuid $USER \
                        --exec $DAEMON -- $DAEMON_ARGS
                log_end_msg $?
                ;;
        stop)
                log_daemon_msg "Stopping $DESC" "$NAME"
                start-stop-daemon --stop --retry=TERM/15/KILL/5 --remove-pidfile --pidfile $PIDFILE
                status=$?
                rm -f $PIDFILE
                log_end_msg $?
                ;;
        status)
                pidofproc -p $PIDFILE $DAEMON >/dev/null
                status=$?
 
                if [ $status -eq 0 ]; then
                        log_success_msg "$DESC is running"
                else
                        log_failure_msg "$DESC is not running"
                fi
                exit $status
                ;;
        reload|force-reload)
                log_daemon_msg "Reloading $DESC configuration..."
                start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
                log_end_msg $?
                ;;
        restart)
                $0 stop
                sleep 1
                $0 start
                ;;
        *)
                echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}"
                exit 1
                ;;
esac

Unformtunately, MS SQL Server 2017 on Debian Jessie is a real pain to install. Newer versions tend to crash (coredump) very often and without a recent openssl-version from jessie-backports (which can only be installed with a little trick nowadays), it just drops every TCP connection to the server on client side with:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.

and on server side respectively with error 0x80090304

So we need a suitable version of MS SQL Server and the correct version of openssl to get it working.
Here is what seems to work here (currently stress testing with HammerDB before productive use):

apt-get install curl apt-transport-https
echo "deb http://archive.debian.org/debian/ jessie-backports main contrib non-free" >>/etc/apt/sources.list
echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until
apt-get update
apt-get install -t jessie-backports openssl
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
apt-get install mssql-server=14.0.1000.169-2
/opt/mssql/bin/sqlservr-setup

Paragon GPT loader #3

By dose | September 28, 2019
Under: Uncategorized
Comments: 6 Comments »

Recently, I bought a 3rd harddisk which is over 2TB in space and added it to my Desktop machine. As mentioned previously,I had to fix the gpt_loader.sys driver in order to not crash.

My patch worked quite well for a few years, but after adding the new drive, it always crashed with 0xc000001d. So I first thought about another bug in the driver, but then I saw, that the ExceptionCode means c000001d Illegal instruction. Then checking with the debugger, I found out that it crashed at a location that I patched. As the instruction in the closeDriver call was bogus,I immediately thought about a reloaction table entry that must have been written ot the wrong location and indeed – when moving up the code by 2 bytes to get space for my patch, I overlooked a reloaction entry in place.

As long as the driver wasn’t moved in memory and got loaded at the preferred load address, the bug didn’t surface,but due to the new drive, it seems that the driver was reloacted and so the bug struck me. Of course, it was easy to patch, I just had to adjust the reloaction table entry by 2 bytes as well. I updated the patch so that it patched this too. If you need to install this fix on your machine, the patch created a gpt_loader.bak file in the %SystemRoot%\drivers directory. Just restore the gpt_loader.bak to gpt_loader.sys, then apply the updated patch from here and also don’t forget to apply the second patch.

If you have further questions, feel free to ask.