Found a regression in Windows Server 2022

%3CLINGO-SUB%20id%3D%22lingo-sub-3016110%22%20slang%3D%22en-US%22%3EFound%20a%20regression%20in%20Windows%20Server%202022%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3016110%22%20slang%3D%22en-US%22%3E%3CP%3EFound%20a%20regression%20in%20Windows%20Server%202022%20since%20evaluating%20the%20preview.%20Have%20recently%20installed%20all%20the%20latest%20updates%20and%20the%20issue%20is%20still%20reproducible.%20How%20should%20we%20report%20this%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3016110%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3016119%22%20slang%3D%22en-US%22%3ERe%3A%20Found%20a%20regression%20in%20Windows%20Server%202022%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3016119%22%20slang%3D%22en-US%22%3EThanks%20for%20your%20feedback.%20Please%20provide%20the%20exact%20steps%20where%20the%20problem%20occurs%20so%20that%20we%20can%20attempt%20to%20reproduce%20the%20issue.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3016122%22%20slang%3D%22en-US%22%3ERe%3A%20Found%20a%20regression%20in%20Windows%20Server%202022%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3016122%22%20slang%3D%22en-US%22%3E%3CP%3ESure%20I%20have%20a%20*.cpp%20file%20that%20you%20can%20run%20to%20reproduce%20this%20issue.%20Should%20I%20simply%20copy%20and%20paste%20the%20content%20here%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Found a regression in Windows Server 2022 since evaluating the preview. Have recently installed all the latest updates and the issue is still reproducible. How should we report this issue?

8 Replies
Thanks for your feedback. Please provide the exact steps where the problem occurs so that we can attempt to reproduce the issue.

Sure I have a *.cpp file that you can run to reproduce this issue. Should I simply copy and paste the content here?

@Mary Hoffman please see the code below. To reproduce, build this cpp file as a console app in Visual Studio (I used VS 2019 but should not matter) first and create a dummy file with the name "¢.¢" (also tested with "£.£"). It works in Windows 10 and some other Windows platforms but failed in Windows Server 2022.

The expected output is shown below (in Windows 10):
AreFileApisANSI() returned 1
cchBytesWritten: 2
fNotMappable: 0
pszFileName: ¢.¢
DeleteFileA() of dummy file returns: 1
DeleteFileA() of ¢.¢ returns: 1

But in Windows Server 2022, deleting the file "¢.¢" failed. 

// TestVar23.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <stdio.h>
#include <iostream>
#include <windows.h>
#include <string>
#include <strsafe.h>

void ErrorExit()
{
    // Retrieve the system error message for the last-error code

    LPVOID lpMsgBuf;
    LPVOID lpDisplayBuf;
    DWORD dw = GetLastError();

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
        dw,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR)&lpMsgBuf,
        0, NULL);

    // Display the error message and exit the process

    lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
        (lstrlen((LPCTSTR)lpMsgBuf) + 40) * sizeof(TCHAR));
    StringCchPrintf((LPTSTR)lpDisplayBuf,
        LocalSize(lpDisplayBuf) / sizeof(TCHAR),
        TEXT("Failed with error code %d: %s"),
        dw, lpMsgBuf);
    MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);

    LocalFree(lpMsgBuf);
    LocalFree(lpDisplayBuf);
    ExitProcess(dw);
}

int main()
{
    //WCHAR wch = 0x00A3;     // Currency symbol, English Pound (different on ANSI and OEM)
    WCHAR wch = 0x00A2;    // The cent symbol '¢'
    WCHAR wszFileName[] = { wch, L'.', wch, L'\0' };
    WCHAR wszInitString[] = { wch, L'\0' };

    BOOL r = AreFileApisANSI();

    std::cout << "AreFileApisANSI() returned " << r << std::endl;

    BOOL    fNotMappable = FALSE;
    WCHAR   wszSource[2];
    char    szDst[5]; // up to 4 bytes for the mappable character, 1 byte for null-terminator
    ULONG   cchBytesWritten = 0;

    wszSource[0] = wch;
    wszSource[1] = 0x0000;

    cchBytesWritten = WideCharToMultiByte(CP_ACP,
        0,
        wszSource,
        -1,
        szDst,
        sizeof(szDst),
        NULL,
        &fNotMappable);

    std::cout << "cchBytesWritten: " << cchBytesWritten << std::endl;
    std::cout << "fNotMappable: " << fNotMappable << std::endl;

    CHAR pszDummy[] = "output.txt";
    FILE* pfile = nullptr;
    fopen_s(&pfile, pszDummy, "w");
    if (pfile != nullptr) {
        fprintf(pfile, "This is dummy output\n");
        fclose(pfile);
    }

    //SetFileApisToANSI();

    SetFileApisToOEM();

    size_t cLen = wcslen(wszFileName) * sizeof(WCHAR);
    CHAR pszFileName[100];

    UINT CodePage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
    INT iResult = WideCharToMultiByte(CodePage, 0, wszFileName, -1, pszFileName, cLen + 1, NULL, NULL);

    std::cout << "pszFileName: " << pszFileName << std::endl;

    BOOL d1 = DeleteFileA(pszDummy);

    std::cout << "DeleteFileA() of dummy file returns: " << d1 << std::endl;

    BOOL d2 = DeleteFileA(pszFileName);

    std::cout << "DeleteFileA() of " << pszFileName << " returns: " << d2 << std::endl;

    ErrorExit();
}

 

@Mary Hoffman is there any update? Just wondering. Thanks! 

I've forwarded this on to the appropriate team and they are investigating. I don't have any further updates yet. Thanks for your patience.
Thank you!
Just want to see if there's any update. If not, I can check back in the new year.