• 常用的编译Qt的配置命令

    ·

    发布于

    修改于

    Qt 5.15.2

    • configure -prefix "C:\Qt\5.15.2\debug" -confirm-license -opensource -debug -shared -platform win32-msvc -opengl desktop -nomake examples -nomake tests -nomake tools -no-compile-examples -skip qtwebengine
    • configure -prefix "C:\Qt\5.15.2\release" -confirm-license -opensource -release -static -static-runtime -platform win32-msvc -opengl desktop -nomake examples -nomake tests -nomake tools -no-compile-examples -skip qtwebengine

    Qt 6.4.2

    • configure -prefix "C:\Qt\6.4.2\debug" -confirm-license -opensource -debug -shared -platform win32-msvc -no-opengl -qt-pcre -qt-zlib -qt-sqlite -nomake examples -nomake tests -nomake tools
    • configure -prefix "C:\Qt\6.4.2\release" -confirm-license -opensource -release -static -static-runtime -platform win32-msvc -no-opengl -nomake examples -nomake tests -nomake tools -skip qtwebengine

  • 不同模式和填充下AES密文的长度

    ·

    发布于

    修改于

    算法/模式/填充            16 字节加密后数据长度     不满 16 字节加密后长度
     
    AES/CBC/NoPadding                16                        不支持 
    AES/CBC/PKCS5Padding             32                        16 
    AES/CBC/ISO10126Padding          32                        16 
    AES/CFB/NoPadding                16                        原始数据长度 
    AES/CFB/PKCS5Padding             32                        16 
    AES/CFB/ISO10126Padding          32                        16 
    AES/ECB/NoPadding                16                        不支持 
    AES/ECB/PKCS5Padding             32                        16 
    AES/ECB/ISO10126Padding          32                        16 
    AES/OFB/NoPadding                16                        原始数据长度 
    AES/OFB/PKCS5Padding             32                        16 
    AES/OFB/ISO10126Padding          32                        16 
    AES/PCBC/NoPadding               16                        不支持 
    AES/PCBC/PKCS5Padding            32                        16 
    AES/PCBC/ISO10126Padding         32                        16

  • 2023啦

    ·

    发布于

    修改于

    2023啦!今年多记录一些东西吧。


  • 阻止clang-format修改文件包含顺序

    ·

    发布于

    修改于

    // clang-format off
    #include <b.h>
    #include <a.h>
    #include <c.h>
    // clang-format on
    #include <d.h>
    #include <e.h>

  • QtCreator显示Qt无效,提示我们make install的解决办法

    ·

    发布于

    修改于

    在qmake.exe所在目录建立名为qt.conf的文件,并录入以下内容:

    [Paths]
    Prefix=..

  • 赛博恶灵

    ·

    发布于

    修改于


  • ubuntu更改DNS服务器

    ·

    发布于

    修改于

    传统的DNS配置文件(/etc/resolv.conf)中写入的地址是127.0.0.53,直接更改这个地址是没用的,重启还会恢复成127.0.0.53。

    正确的做法是在网络配置文件里直接修改,路径是/etc/netplan/*.yaml。


  • CMAKE MSVC设置C、C++运行库链接方式

    ·

    发布于

    修改于

    New in version 3.15.
    
    Select the MSVC runtime library for use by compilers targeting the MSVC ABI.
    
    The allowed values are:
    
    MultiThreaded
    
    
    Compile with -MT or equivalent flag(s) to use a multi-threaded statically-linked runtime library.
    
    MultiThreadedDLL
    
    
    Compile with -MD or equivalent flag(s) to use a multi-threaded dynamically-linked runtime library.
    
    MultiThreadedDebug
    
    
    Compile with -MTd or equivalent flag(s) to use a multi-threaded statically-linked runtime library.
    
    MultiThreadedDebugDLL
    
    
    Compile with -MDd or equivalent flag(s) to use a multi-threaded dynamically-linked runtime library.
    
    The value is ignored on non-MSVC compilers but an unsupported value will be rejected as an error when using a compiler targeting the MSVC ABI.
    cmake_minimum_required(VERSION 3.15)
    cmake_policy(SET CMP0091 NEW)
    project(my_project)
    
    add_executable(foo foo.c)
    set_property(TARGET foo PROPERTY
                 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

  • 用MultiByteToWideChar将文件编码从UTF8转为UTF16

    ·

    发布于

    修改于

    bool utf8_to_utf16(const char *fpath)
    {
        bool ret = false;
        HANDLE fileHandle;
        DWORD fileSize;
        PCHAR fileBuffer = nullptr;
        char16_t* utf16Buffer = nullptr;
        DWORD numberOfBytesRead;
        DWORD numberOfBytesWritten;
        fileHandle = ::CreateFileA(fpath,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
        if (fileHandle == INVALID_HANDLE_VALUE)
            return false;
        do
        {
            fileSize = ::GetFileSize(fileHandle,NULL);
            if (fileSize == 0)
                break;
            fileBuffer = new (std::nothrow) CHAR[fileSize];
            if (fileBuffer == nullptr)
                break;
            if (::ReadFile(fileHandle,fileBuffer,fileSize,&numberOfBytesRead,NULL) == FALSE)
                break;
            int result = ::MultiByteToWideChar(
              CP_UTF8,       // Source string is in UTF-8
              MB_PRECOMPOSED | MB_ERR_INVALID_CHARS,        // Conversion flags
              fileBuffer,   // Source UTF-8 string pointer
              fileSize,    // Length of source UTF-8 string, in chars
              NULL,     // Pointer to destination buffer
              0    // Size of destination buffer, in wchar_ts
            );
            if (result == 0)
                break;
            utf16Buffer = new (std::nothrow) char16_t[result];
            if (utf16Buffer == nullptr)
                break;
            result = ::MultiByteToWideChar(
              CP_UTF8,       // Source string is in UTF-8
              MB_PRECOMPOSED | MB_ERR_INVALID_CHARS,        // Conversion flags
              fileBuffer,   // Source UTF-8 string pointer
              fileSize,    // Length of source UTF-8 string, in chars
              (LPWSTR)utf16Buffer,     // Pointer to destination buffer
              result    // Size of destination buffer, in wchar_ts
            );
            if (result == 0)
                break;
            if (::SetFilePointer(fileHandle,0,NULL,FILE_BEGIN) == FALSE)
                break;
            if (::WriteFile(fileHandle,"\xFF\xFE",2,&numberOfBytesWritten,NULL) == FALSE || numberOfBytesWritten !=2 )
                break;
            if (::WriteFile(fileHandle,utf16Buffer,result * sizeof(char16_t),&numberOfBytesWritten,NULL) == FALSE || numberOfBytesWritten != result * sizeof(char16_t))
                break;
            if (::SetEndOfFile(fileHandle) == FALSE)
                break;
            ret = true;
        }while(0);
        if (utf16Buffer)
            delete utf16Buffer;
        if (fileBuffer)
            delete fileBuffer;
        ::CloseHandle(fileHandle);
        return ret;
    }

  • Synthetic SCSI Controller…账户没有权限打开附件…

    ·

    发布于

    修改于

    当我们移动hyper-v虚拟机到新磁盘后,启动虚拟机是会出现下面的提示,意思就是虚拟机的磁盘文件没有权限,只需要用命令行给虚拟磁盘文件添加权限即可解决。

    错误提示
    icacls "C:\testvm\testvm\Virtual Hard Disks\testvm.vhdx" /grant "NT VIRTUAL MACHINE\3C910E28-7885-4BF4-94A5-AC9EA3F62796":(F)
    命令执行

最新