Monday, 20 September 2021

Surface Pro 4 display issues: clear registry cache

From this article - to clear the display cache:

Windows Registry Editor Version 5.00



Saturday, 4 September 2021

HP EliteBook 840 G2 - WiFi keeps turning off

After a reinstall of Windows 10 on my HP EliteBook 840 G2, I found that I could not get the WiFi to work. 

The hardware Wifi button in the top right corner of the laptop was showing white. Whenever I discconect the Ethernet cable you would get the globe symbol in the system tray. If you turned WiFi on from this pop-up, you would see the list of SSIDs and then they would disappear one second later and the WiFi would show disconnected. The fact they appeared showed the adapter was physically working.

The machine dual-booted to Linux and there were no problems there, so this was clearly a Windows [driver] problem.

Nothing was visible in the Event Log.

I ran the network troubleshooter and it said:

Result of diagnosis: Problem found

Root cause:
Wireless capability is turned off

Detailed root cause:
Radio is off (SW switch)

Repair option:
Turn on wireless capability

The correct drivers had been installed.

I had unchecked the "Allow the computer to turn off this device to save power".

I uninstalled the drivers.

I installed the HP Wireless Button Driver.

The WiFI/LAN switching was turned off in the BIOS.

None of this worked.

In the end this post found the problem.

My list of network adapters included a TAP-Windows Adapter. This is deemed to be an ethernet connection. Although you disconnect the physical ethernet connection ("Ethernet" in my list), the Ethernet2 remains virtually "connected". And Windows will not allow both an Ethernet and a Wifi connection to remain active simultaneously, so it turns off your Wifi again. Disabling this allowed the Wifi to work continuously.

Examining the TAP adapter, I could see it was installed by a VPN provider.

Clicking the properties, I could see a setting "Media Status". It defaulted to Always Connected. Setting this to "Application Controlled" meant that the adapter would only be active when the VPN demanded it, thus it would be disabled at other times. This meant that if the physical ethernet was disabled and the VPN was not active, the TAP adapter would be disabled and WiFi would resume. Voila!

Wednesday, 25 August 2021

Visual Studio function address different in watch window from code

 In my code I had:

void function2()


    std::cout << "Malware payload that should never be run!\n";



void (*pFun)() = &function2;

When I inspect pFun it returns the address 

0x0092141f {BufferOverrunExample.exe!function2(void)}

But in the watch window it is

Why the difference?

If we inspect 0x0092141f  in the dissasembly window:

You can see it simply jumps to the same address as shown in the watch window. This is a jump table.


This explains about incremental linking
c++ - Why doesn't VS2015 debugger show the function address correctly in the watch window? - Stack Overflow

"This behavior seems to be because of incremental linking. When it is enabled, the function is assembled in one memory address and another address contains a jump table entry with one jump instruction to the 'real' address. The function is always called by calling the jump table. If you disable incremental linking, the 'detour' via the jump table goes away and also your example case shows just one address.

Everything else seems to show the address to the jump table, but the 'printStuff' and '&printStuff' watch expressions show the actual address where the function code is located."

Linkers & Jump tables

Canary bytes, prologues and epilogues

Stack Guard

Address layout randomisation

CC bytes

Mitigate threats by using Windows 10 security features (Windows 10) - Windows security | Microsoft Docs

Friday, 6 August 2021

Terraform fails to import App Service Plan: ID was missing the `serverfarms` element

 When importing an Azure App Service Plan, using the resource ID copied from Azure Resource Explorer:

terraform import "/subscriptions<mysubscriptionId>/resourceGroups<myresoureegroup>/providers/Microsoft.Web/serverFarms/<myAppServicePlan>"

I got the error:

Error: parsing Resource ID "XXX": ID was missing the `serverfarms` element

Note serverfarms is case sensitive and should all be lower case, wherease Azure Resource Explorer is camelCase.

Monday, 2 August 2021

Friday, 30 July 2021

Can't upload files to GoDaddy Managed WordPress - 0 byte files and disconnects

 I spent a couple of hours trying to work out why I could not upload files to GoDaddy's Managed WordPress.

I was using FileZilla on Windows 10, and connected via SFTP to the Managed Wordpress instance as detailed in GoDaddy's control panel.

Whenever I uploaded media to wp-content/uploads, it would error with 0-byte files and server disconnects.

The solution?

Bizarrely, disable and reenable your NIC. Yes, I did say that.

It's the first time I've ever experienced a software problem get fixed by disabling a NIC. What's the relationship between GoDaddy's SFTP server and your NIC? Maybe when it goes to sleep it doesn't fully restore in a way that allows SFTP to be negotiated correctly?

Monday, 26 July 2021

Touchpad jumps on Ubuntu on HP Elitebook 840 G2

The cursor would jump around when typing on an HP Elitebook 840 G2, running Ubuntu.

In the end the following settings worked:

 Natural scrolling off

Tap to click off

Two finger scrolling on

Edge scrolling off

Helped from here