wine安装IDA7.5后,安装了python3.8,一直启动提示如下:

from PyQt5 import QtCore, QtGui
ImportError: DLL load failed while importing sip: 找不到模块。

明明pip安装了pyqt5模块,试过3.8 3.9 3.10版本都相同

解决方法:

/home/key/.wine/drive_c/Program Files/Python3/Lib/site-packages/PyQt5/sip.cp310-win_amd64.pyd /opt/ida7.5/python/3/PyQt5/

安装

nvidia-open-dkms
(依赖会自动安装nvidia-utils, linux-headers 如果没有也要安装)

查询

glxinfo -B
nvidia-smi

X11/xorg

查看是否存在/etc/X11/xorg.conf
如果没有,使用nvidia-xconfig自动生成一份
记得里面需要xserver路径(没有手动修改):

Section "Files"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

wayland

查看是否加载nvidia_drm
没有的话方式有二:
1, 创建文件/etc/modprob.d/nv_wayland.conf
options nvidia_drm modeset=1
\#options nvidia NVreg_PreserveVideoMemoryAllocations=1

2, # /etc/default/grub
GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1"

grub-mkconfig -o /boot/grub/grub.cfg

//?手动增加
mkinitcpio -p linux
(arch版本update-initramfs)

470-510版本还需要
ln -s /dev/null /etc/udev/rules.d/61-gdm.rules

判断是否设置成功:(必须为Y)
cat /sys/module/nvidia_drm/parameters/modeset

下载archlinux镜像文件rufus写盘

https://mirrors.ustc.edu.cn/archlinux/iso/latest/archlinux-x86_64.iso

进入Live先关闭reflector,因为它会自动修改源顺序

systemctl stop reflector

ping一下,没连网无线网卡使用wpa_supplicant或iwctl连网

iwctl
   #进入到#[iwctl]后
   station wlan0 scan   #默认网卡驱动都是wlan0
   station wlan0 get-networks    #获取可连接wifi列表
   station wlan0 connect 你要连接的wifi名
   #输入密码
   quit   #退出

   #测试网络连接
   ping baidu.com

同步电脑时间

timedatectl set-timezone Asia/Shanghai

使用fdisk -l查看分区情况,使用cfdisk分区,尽量选用UEFI/gpt分区格式

/dev/sda1 512MB EFI
/dev/sda2 内存大小 swap
/dev/sda3 50G linux(/根目录)
/dev/sda4 200G linux(/home)
mkfs.fat -F 32 /dev/sda1
mkswap /dev/sda2 && swapon /dev/sda2
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda4

parted -l(查看分区格式)
mount /dev/sda3 /mnt
mkdir /mnt/home
mount /dev/sda4 /mnt/home

更新live软件源

nano /etc/pacman.d/mirrorlist
(第一行加入)
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
pacman -Syy
pacman -S archlinux-keyring

脚本安装【内核基础固件驱动等】主要文件到挂载的根目录

pacstrap /mnt base base-devel linux linux-firmware linux-headers

安装必要软件

pacstrap /mnt grub efibootmgr intel-ucode
pacstrap /mnt networkmanager dhcpcd openssh vim git bash-completion
(amd CPU就装amd-ucode  双系统需要装os-prober)

创建, 挂载EFI分区, 并生成fstab

mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
(检查各分区是否都被启动挂载)

切根目录

arch-chroot /mnt

设置时区, 并生成/etc/adjtime

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc

生成本地支持环境语言

nano /etc/locale.gen
去掉en_US.UTF-8和zh_CN.UTF-8前注释
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf

设置ROOT密码和增加用户

passwd root
useradd -m -G wheel xxx
passwd xxx
nano /etc/sudoers
wheel ALL=(ALL:ALL) NOPASSWD: ALL
(去掉前面的#后sudo免密码)

安装grub并生成grub.cfg

如果双系统,去掉/etc/default/grub文件中这行注释
GRUB_DISKABLE_OS_PROBER=false

传统引导:
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

UEFI 引导:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

启动ssh和网络服务

systemctl enable sshd
systemctl enable NetworkManager
systemctl enable dhcpcd

安装桌面环境和登陆器, 启动登陆器服务

pacman -S gnome gnome-tweaks gdm
systemctl enable gdm

退出重启

exit
(退出chroot环境)
umount -a
reboot

进桌面后配置

修改为国内源 并 增加32位软件源支持
sudo vim /etc/pacman.conf
增加
[archlinuxcn]
SigLevel = Optional TrustAll
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch

删除前面#
[multilib]
Include = /etc/pacman.d/mirrorlist

sudo pacman -Syyu
sudo pacman -S archlinuxcn-keyring

配置~/.bashrc
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
fi

安装paru (或yay)
sudo pacman -S paru
删除#
/etc/paru.conf
BottomUp

没有声音:
sudo pacman -S alsa-firmware
sudo pacman -S sof-firmware
sudo pacman -S alsa-ucm-conf

输入法
sudo pacman -S fcitx5 fcitx5-im fcitx5-chinese-addons fcitx5-configtool
vim /etc/environment
export GTK_IM_MODULE=fcitx5
export QT_IM_MODULE=fcitx5
export XMODIFIERS=@im=fcitx

qv2ray缺少libfuse2 libcrypt.so.1
sudo pacman -S fuse2
sudo pacman -S libxcrypt-compat

sudo pacman -S gnome-browser-connector
AppIndicator and KStatusNotifierItem Support
Dash to Panel
Desktop Icons(DING)
Blur my Shell
Burn My Windows
Compiz alike magic lamp effect
Compiz windows effect

gedit //gnome文本编辑器?
gnome-nettool //gnome网络工具?
file-roller // gnome归档管理器
seahorse //保存程序的PGP密钥

pacman -S alsa-utils pulseaudio pulseaudio-bluetooth

sudo pacman -S nvidia nvidia-prime nvidia-settings nvidia-utils opencl-nvidia lib32-nvidia-utils lib32-opencl-nvidia libva-vdpau-driver
sudo pacman -S nvidia-open nvidia-settings lib32-nvidia-utils
sudo pacman -S nvidia-open-dkms optimus-manager
optimus-manager --switch nvidia
nvidia-xconfig
nvidia-smi
yay -S mutter-x11-scaling
gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']"
pacman -S sof-firmware sof-tools alsa-ucm-conf


https://wiki.archlinuxcn.org/wiki/
http://blog.chinaunix.net/uid-25906175-id-3072940.html
https://www.bilibili.com/read/cv20753052/

//微信需要的字体
sudo pacman -S wqy-microhei
sudo pacman -S adobe-source-han-serif-cn-fonts
sudo pacman -S adobe-source-han-sans-cn-fonts
sudo pacman -S ttf-roboto
sudo pacman -S noto-fonts
sudo pacman -S noto-fonts-cjk
sudo pacman -S ttf-dejavu

~/.config/fontconfig/fonts.conf 或 /etc/fonts/local.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
    <its:translateRule
      translate="no"
      selector="/fontconfig/*[not(self::description)]"
    />
  </its:rules>

  <description>Android Font Config</description>

  <!-- Font directory list -->

  <dir>/usr/share/fonts</dir>
  <dir>/usr/local/share/fonts</dir>
  <dir prefix="xdg">fonts</dir>
  <!-- the following element will be removed in the future -->
  <dir>~/.fonts</dir>

  <!-- 关闭内嵌点阵字体 -->
  <match target="font">
    <edit name="embeddedbitmap" mode="assign">
      <bool>false</bool>
    </edit>
  </match>

  <!-- 英文默认字体使用 Roboto 和 Noto Serif ,终端使用 DejaVu Sans Mono. -->
  <match>
    <test qual="any" name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Noto Serif</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Roboto</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>DejaVu Sans Mono</string>
    </edit>
  </match>

  <!-- 中文默认字体使用思源黑体和思源宋体,不使用 Noto Sans CJK SC 是因为这个字体会在特定情况下显示片假字. -->
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Source Han Serif CN</string>
    </edit>
  </match>
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Noto Sans Mono CJK SC</string>
    </edit>
  </match>

  <!-- Windows & Linux Chinese fonts. -->
  <!-- 把所有常见的中文字体映射到思源黑体和思源宋体,这样当这些字体未安装时会使用思源黑体和思源宋体.
解决特定程序指定使用某字体,并且在字体不存在情况下不会使用fallback字体导致中文显示不正常的情况. -->
  <match target="pattern">
    <test qual="any" name="family">
      <string>WenQuanYi Zen Hei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>WenQuanYi Micro Hei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>WenQuanYi Micro Hei Light</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>Microsoft YaHei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimHei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimSun</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Serif CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimSun-18030</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Serif CN</string>
    </edit>
  </match>

  <!-- Load local system customization file -->
  <include ignore_missing="yes">conf.d</include>

  <!-- Font cache directory list -->

  <cachedir>/var/cache/fontconfig</cachedir>
  <cachedir prefix="xdg">fontconfig</cachedir>
  <!-- the following element will be removed in the future -->
  <cachedir>~/.fontconfig</cachedir>

  <config>
    <!-- Rescan configuration every 30 seconds when FcFontSetList is called -->
    <rescan>
      <int>30</int>
    </rescan>
  </config>
</fontconfig>

方法一:

1,第一步下载winehq9.0源码:

https://www.winehq.org/

1,编译wine 32位和64位共存

(这一步很重要,如果你想装64位微信就得有64位wine容器,但只编译64位版本因为缺少system32里面文件也会安装不起来)

  • 创建两文件夹wine32 wine64 将源码解压2份放入两个文件夹
  • 修改两文件夹源码dlls/user32/win.c文件

      cs.lpszClass      = className;
      cs.dwExStyle      = exStyle;
      //-------如下是增加的
      if (exStyle == 0x080800a0) // WeChat/WxWork shadow hwnd
      {
          FIXME("hack %x\n", cs.dwExStyle);
          return NULL;
      }
      if (exStyle == 0x000800a0) // Netease Cloudmusic shadow wnd
      {
          FIXME("hack %x\n", cs.dwExStyle);
          return NULL;
      }
      //-------上面是增加的
      return wow_handlers.create_window( &cs, className, instance, TRUE );
    }
    sudo dpkg --add-architecture i386
    sudo apt -y install build-essential && sudo apt -y install libc6-dev:i386 && sudo apt-get -y install gcc-multilib
    sudo apt-get install flex bison libx11-dev:i386
    sudo apt-get install libfreetype-dev:i386
    sudo apt-get install libx11-dev
    sudo apt-get install libfreetype-dev
    
    export C_INCLUDE_PATH=/usr/include/freetype2
    export CPLUS_INCLUDE_PATH=/usr/include/freetype2
    
    cd wine64
    ./configure --enable-win64
    make -j 8
    
    cd ../wine32
    ./configure --with-wine64=../wine64
    (编译32位wine时通过--with-wine64参数指定了已编译完成的wine64位的目录,这样编译32位wine时,程序会注入64位版本处理32位程序所需的库。)
    make -j 8
    
    sudo make DESTDIR=/opt/wine install
    cd ../wine64
    sudo make DESTDIR=/opt/wine install

    如上一定注意编译和安装顺便,编译要先编译64位,再编译32位,安装的话先安装32位再安装64位

3,配置安装

cd /opt/wine/usr/local/bin
(可以wine安装完找不到路径就执行这句,可有可无)
export WINEARCH=win64
(指定架构,好像老版本才用,可有可无)
export WINEPREFIX=~/.wine
(配置容器路径)
winecfg
(初始化,改缩放192)
sudo apt install winetricks
(安装wine搭档)
winetricks
(界面选择安装riched20 riched32)
winecfg
(函数库 riched20 riched32都是原装先于内建,wechatocr.exe停用)
env WINEPREFIX=~/.wine /opt/wine/usr/local/bin/wine64 ~/Downloads/WeChatSetup.exe

方法二:

X api
第一种同样是隐藏窗体,但是在X的层面进行的操作. 然而网上使用的方法大多是错误的, 要么是漏杀, 要么是错杀. 我写了一个正确的程序, 可以正确的隐藏阴影框, 同时不影响各个菜单.

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xproto.h>

static xcb_connection_t *conn;
static xcb_screen_t *scr;
static xcb_atom_t atom;

void init_atom() {
  // Get `_NET_WM_NAME` atom
  const char *atom_name = "_NET_WM_NAME";
  xcb_intern_atom_cookie_t atom_cookie =
      xcb_intern_atom(conn, true, strlen(atom_name), atom_name);
  xcb_intern_atom_reply_t *atom_reply =
      xcb_intern_atom_reply(conn, atom_cookie, NULL);
  if (!atom_reply) {
    fprintf(stderr, "_NET_WM_NAME atom not found, WTF?\n");
    return;
  }
  atom = atom_reply->atom;
  free(atom_reply);
}

void handle_wechat(xcb_window_t window) {
  // Get value of `_NET_WM_NAME`
  xcb_icccm_get_text_property_reply_t prop;
  if (!xcb_icccm_get_text_property_reply(
          conn, xcb_icccm_get_text_property(conn, window, atom), &prop, NULL)) {
    fprintf(stderr, "Can't get _NET_WM_NAME property\n");
    return;
  }
  if (prop.name_len) {
    printf("Normal window with name: %.*s\n", prop.name_len, prop.name);
    return;
  }
  // If `_NET_WM_NAME` is empty, check if this windows accept input
  xcb_icccm_wm_hints_t hints;
  if (!xcb_icccm_get_wm_hints_reply(conn, xcb_icccm_get_wm_hints(conn, window),
                                    &hints, NULL)) {
    fprintf(stderr, "Can't get WM_HINTS property\n");
    return;
  }
  if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && hints.input) {
    printf("Normal dialog without name\n");
    return;
  }
  printf("Black shadow window, unmap it!\n");
  xcb_unmap_window(conn, window);
  return;
}

bool is_wechat(xcb_window_t window) {
  xcb_get_property_cookie_t cookie = xcb_get_property(
      conn, 0, window, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 0, 32);
  xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, cookie, NULL);
  if (!reply) {
    return false;
  }
  int len = xcb_get_property_value_length(reply);
  if (!len) {
    free(reply);
    return false;
  }
  char *property = (char *)xcb_get_property_value(reply);
  printf("0x%0x8: WM_CLASS= %.*s\n", window, len, property);
  bool result = false;
  if (!strcmp(property, "wechat.exe")) {
    printf("Wechat found!\n");
    result = true;
  }
  free(reply);
  return result;
}

int main(int argc, char **argv) {
  conn = xcb_connect(NULL, NULL);
  if (xcb_connection_has_error(conn)) {
    fprintf(stderr, "Failed to connect to the X server\n");
    exit(1);
  }
  scr = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
  if (!scr) {
    fprintf(stderr, "Failed to get X screen\n");
    exit(2);
  }

  uint32_t val[] = {XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY};
  xcb_change_window_attributes(conn, scr->root, XCB_CW_EVENT_MASK, val);

  init_atom();

  while (1) {
    xcb_aux_sync(conn);
    xcb_generic_event_t *e = xcb_wait_for_event(conn);
    if (XCB_EVENT_RESPONSE_TYPE(e) == XCB_MAP_NOTIFY) {
      xcb_map_notify_event_t *map = (xcb_map_notify_event_t *)e;
      if (is_wechat(map->window)) {
        handle_wechat(map->window);
      }
    }
    free(e);
  }

  if (conn) {
    xcb_disconnect(conn);
  }
  return 0;
}

编译方法:

gcc xwechathide.c -lxcb -lxcb-util -lxcb-icccm -o xwechathide

转至https://12101111.github.io/block-wine-wechat-black-window/

When searching:
\n is newline, \r is CR (carriage return = Ctrl-M = ^M)

When replacing:
\r is newline, \n is a null byte (0x00).