Priority of operator

Upper operators are more preemptive than lower ones.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
left to right	[] () . -> rear++ rear--
right to left	front++ front-- sizeof & * +(positive) -(negitive) ~ !
right to left	(mandatory transform)
left to right	.* ->*
left to right	* / %
left to right	+ -
left to right	<< >>
left to right	< > <= >=
left to right	== !=
left to right	&
left to right	^
left to right	|
left to right	&&
left to right	||
right to left	?:
right to left	= *= /= %= += -= <<= >>= &= ^= |=
left to right	,

refer to:
https://blog.csdn.net/l2014010671/article/details/104636916

Download all debug symbols for Win10

Download app symbols,

1
2
3
4
set SYMURL=SRV*C:\MySymbols\*http://msdl.microsoft.com/download/symbols
#symchk /om c:\MySymbols\app_manifest.txt /ie explorer.exe
#symchk /im c:\MySymbols\app_manifest.txt /s %SYMURL%
symchk /r /ie explorer.exe /s %SYMURL%

Download kernel symbols,

1
symchk /r c:\windows\system32\ntoskrnl.exe /s %SYMURL%

Setup symbols path for WinDbg and IDA in console with Administrator privilege,

1
2
setx /m _NT_SYMBOL_PATH SRV*c:\\MySymbols*http://msdl.microsoft.com/download/symbols/
#.

ps. SymChk is in WinDbg tools.

refer to:
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/using-a-manifest-file-with-symchk
https://blog.csdn.net/ziwei960319/article/details/122212998
https://www.cnblogs.com/antigao/p/4584034.html

Source and destination

Colored item indicates destination.

param 1 param 2
Tell him(indirect object) the truth(direct object)
Replace rice with noodles
Prefer coffee to tea
substitute dest for src
substitute src with dest
grep word file
find directory -name "*key*"
cp src dest
ln src link
chown owner file
strcpy dest src
#define macro expression
typedef source type
mklink link src

Recover Fedora after EFI partition is deleted by shaking hand

Make a Fedora live USB stick, plug it in the pc and power up, when grub menu appears, type ctrl + e, using tab key find the real path when editing,

linux (hd2,gpt3)/boot/vmlinuz-5.16.12-200.fc35.x86_64 root=/dev/sda3 ro rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1
initrd (hd2,gpt3)/boot/initramfs-5.16.12-200.fc35.x86_64.img

press ctrl + x to boot.

If encounter

Cannot open access to console, the root account is locked.

It means the password of root is not set so far,

Reboot to Fedora live environment,

# /dev/sda3 is the root partition.
mkdir /tmp/sda3
mount /dev/sda3 /tmp/sda3
cd /tmp/sda3
mount -o bind /dev ./dev
mount -t proc proc ./proc
mount -t sysfs sys ./sys
chroot .
passwd root

Now we have set up root password, then retry previous step to boot in local Fedora.

sudo su

# For security, Fedora coder disables directly building loader files in EFI partition.
# we can not invoke like this: grub2-install /dev/sda

dnf reinstall grub2-efi-x64 shim-x64
dnf install grub2-efi-x64-modules

# for how to register startup item in EFI NVRAM, get it from
#grep efibootmgr /var/log/anaconda/storage.log

# we make /dev/sda1 as EFI partition.
# -c = create
# -d = disk
# -p = EFI partition number, start from 1
# -l = loader path
efibootmgr -c -w -L Fedora -d /dev/sda -p 1 -l \EFI\fedora\shimx64.efi

refer to:
https://bugzilla.redhat.com/show_bug.cgi?id=1917213

Burn iso to USB stick for Windows installation

  • Rufus, released only in Windows.

    https://rufus.ie/en/
    https://github.com/pbatard/rufus

  • WoeUSB, can run in Linux.

    1
    2
    3
    
    dnf install WoeUSB
    # /dev/sdd is the u-disk
    woeusb --device /path/to/cn_windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24.iso /dev/sdd

Install VMWare Player in Fedora

After

1
dnf install kernel-headers kernel-devel

we still failed building kernel modules for VMWare Player in fedora,

1
vm_basic_defs.h:54:12: fatal error: stddef.h: No such file or directory

A solution is

1
2
3
4
# e.g. current kernel version is 5.16.12-200.fc35.x86_64
cd /usr/src/kernel/5.16.12-200.fc35.x86_64/include
ln -s linux/stddef.h stddef.h
ln -s linux/stdarg.h stdarg.h

refer to:
https://stackoverflow.com/questions/54480765/how-can-i-solve-stdarg-h-no-such-file-or-directory-while-compiling-out-of-tree-l

Change grub2 default startup item in Fedora

Confirm our OS is in BIOS or EFI,

1
2
3
4
# in BIOS system
GRUB_CFG=/boot/grub2/grub.cfg
# in EFI system
GRUB_CFG=/boot/efi/EFI/fedora/grub.cfg

Then lookup the booting item id we want to set as default.

If we only want to switch default between Linux kernels,

1
grubby --info ALL

Else if we want to change default booting item to Windows,

1
cat $GRUB_CFG | grep Windows

Read the output, we will find the item, e.g. corresponding to the name, the id is "e528434f2b3e4d7c97d97aa4aabb976e-5.16.7", write it in /etc/default/grub

1
2
#GRUB_DEFAULT=saved
GRUB_DEFAULT=e528434f2b3e4d7c97d97aa4aabb976e-5.16.7

Finally update grub,

1
2
grub2-mkconfig -o $GRUB_CFG
#.

Reboot to see the change.

And in Ubuntu, how to make grub2 remember last choice?

sudo vi /etc/default/grub
	GRUB_DEFAULT=saved
	GRUB_SAVEDEFAULT=true
sudo update-grub

refer to:
https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/

Fedora 21 改变启动顺序以及grub2 配置技巧


https://askubuntu.com/questions/148662/how-to-get-grub2-to-remember-last-choice

Directories in Win10

Not only one Startup directory,

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
C:\Users\euhat\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Themes downloaded from Windows Store,

C:\Users\euhat\AppData\Local\Microsoft\Windows\Themes

Linux subsystem Ubuntu,

C:\Users\euhat\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_xxxx\LocalState\rootfs

Need to clean,

C:\ProgramData\Package Cache
Control Panel\All Control Panel Items\Administrative Tools\Task Scheduler\Task Scheduler Library\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser

refer to:
https://blog.csdn.net/weixin_48160438/article/details/113413048

CreateTexture2D E_INVALIDARG

  1. Ensure "Graphics Tools" installed.

    Go to the Settings panel, under System, Apps & features, Manage optional Features, Add a feature, and then look for "Graphics Tools".

  2. Enable the debug layer by code,

    1
    2
    3
    4
    5
    6
    
    D3D11CreateDevice(
    	nullptr,
    	D3D_DRIVER_TYPE_HARDWARE,
    	nullptr,
    	XXX | D3D11_CREATE_DEVICE_DEBUG, // add here!
    	...);

    or in Visual Studio, on the main menu, choose Debug, Graphics, setup in DirectX Control Panel.

  3. Restart debug session. And after CreateTexture2D returns E_INVALIDARG, there will be debug informations in VS IDE Output Panel, each one of which begins with like "D3D11 ERROR".

refer to:
https://docs.microsoft.com/en-us/visualstudio/debugger/graphics/getting-started-with-visual-studio-graphics-diagnostics
https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-layers
https://stackoverflow.com/questions/53569263/directx-11-id3ddevicecreatetexture2d-with-initial-data-fail
https://blog.rthand.com/capture-directx-10-11-debug-output-to-visual-studio/
https://article.itxueyuan.com/dwlpL
https://walbourn.github.io/