#1 Native x64 version...

Aperto
aperto 2 anni fa da DeltaFoX · 9 commenti
DeltaFoX commented 2 anni fa

Hi mr doublesine Can help me to adapt code Patch for VisualAssist on new 64 version dll for latest VS 2022 native x64?

Build 2022.1 Release date: 2022.01.21 Version 10.9.2443

VA_X64.dll

https://mega.nz/file/6s1wCZBA#zycmnktPFNw12sV37xMXVYVLtRPvnnpsfgKSnFw_tCI

Thanks and Best Regards

Hi mr doublesine Can help me to adapt code Patch for VisualAssist on new 64 version dll for latest VS 2022 native x64? Build 2022.1 Release date: 2022.01.21 Version 10.9.2443 VA_X64.dll https://mega.nz/file/6s1wCZBA#zycmnktPFNw12sV37xMXVYVLtRPvnnpsfgKSnFw_tCI Thanks and Best Regards
Double Sine commented 2 anni fa
Proprietario

OK, I will take a look as soon as possible.

OK, I will take a look as soon as possible.
DeltaFoX commented 2 anni fa
Autore

many thank's for your time...

many thank's for your time...
Double Sine commented 2 anni fa
Proprietario

The patched VA_X64.dll for 10.9.2443.0 has been uploaded.

The patched VA_X64.dll for 10.9.2443.0 has been uploaded.
DeltaFoX commented 2 anni fa
Autore

Many thanks you Think about updating the code on the HyperSine github?

Best regards

Many thanks you Think about updating the code on the HyperSine github? Best regards
Double Sine commented 2 anni fa
Proprietario

Code has been uploaded. Previous code is archived in archived-cpp branch.

Code has been uploaded. Previous code is archived in `archived-cpp` branch.
DeltaFoX commented 2 anni fa
Autore

Many thanks for all..

Many thanks for all..
DeltaFoX commented 2 anni fa
Autore

@Double Sine I have a little OT...

I need if possible an help on this problems :

I have this string hex :

1) 03 02 04 02 0c 02 05 02 2a 02 0e 02 0c 02 05 02 12 02 44 02 03 02 1e 02

and an sw passed this string hex at call c++ WideCharToMultiByte:

Codepage = 0xfde9; v4 = 0xD;

result = (LPSTR *)WideCharToMultiByte(CodePage, 0, lpString, v4, *a1, 4 * v4, 0, 0);

a1 = C8 83 c8 84 c8 8c c8 85 c8 aa c8 8e c8 8c c8 85 c8 92 c9 84 c8 83 c8 9e

a1 is a correct result....

I try to replicate in C# the same whitout success in this way :

1) [DllImport("kernel32.dll")]

    static extern int WideCharToMultiByte(uint CodePage, uint dwFlags,

[MarshalAs(UnmanagedType.LPWStr)] string lpWideCharStr, int cchWideChar, [MarshalAs(UnmanagedType.LPArray)] Byte[] lpMultiByteStr, int cbMultiByte, IntPtr lpDefaultChar, out bool lpUsedDefaultChar);

Int32 iNewDataLen = 0x34;

            Byte[] byNewData = null;
            bool bDefaultChar = false;
            string s = Encoding.UTF8.GetString(.......);
            int sl = s.Length;
            byNewData = new Byte[0x34];
            iNewDataLen = WideCharToMultiByte(0xfde9, 0, s, sl, byNewData, iNewDataLen, IntPtr.Zero, out bDefaultChar);

but byNewData for me is wrong... you know another way?

tks for any reply

@Double Sine I have a little OT... I need if possible an help on this problems : I have this string hex : 1) 03 02 04 02 0c 02 05 02 2a 02 0e 02 0c 02 05 02 12 02 44 02 03 02 1e 02 and an sw passed this string hex at call c++ WideCharToMultiByte: Codepage = 0xfde9; v4 = 0xD; result = (LPSTR *)WideCharToMultiByte(CodePage, 0, lpString, v4, *a1, 4 * v4, 0, 0); a1 = C8 83 c8 84 c8 8c c8 85 c8 aa c8 8e c8 8c c8 85 c8 92 c9 84 c8 83 c8 9e a1 is a correct result.... I try to replicate in C# the same whitout success in this way : 1) [DllImport("kernel32.dll")] static extern int WideCharToMultiByte(uint CodePage, uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string lpWideCharStr, int cchWideChar, [MarshalAs(UnmanagedType.LPArray)] Byte[] lpMultiByteStr, int cbMultiByte, IntPtr lpDefaultChar, out bool lpUsedDefaultChar); Int32 iNewDataLen = 0x34; Byte[] byNewData = null; bool bDefaultChar = false; string s = Encoding.UTF8.GetString(.......); int sl = s.Length; byNewData = new Byte[0x34]; iNewDataLen = WideCharToMultiByte(0xfde9, 0, s, sl, byNewData, iNewDataLen, IntPtr.Zero, out bDefaultChar); but byNewData for me is wrong... you know another way? tks for any reply
Double Sine commented 2 anni fa
Proprietario

WideCharToMultiByte with code page CP_UTF8(0xfde9) is just converting a UNICODE-encoded byte array to a UTF8-encoded byte array where UNICODE-encoded is actually UTF16-LE-encoded.

So the hex string you give

03 02 04 02 0c 02 05 02 2a 02 0e 02 0c 02 05 02 12 02 44 02 03 02 1e 02

is UNICODE-encoded.

The correct result

C8 83 c8 84 c8 8c c8 85 c8 aa c8 8e c8 8c c8 85 c8 92 c9 84 c8 83 c8 9e

is UTF8-encoded.

You should decode source hex string in UNICODE and then encode in UTF8, which is quite simple and you don't have to call Win32 API explictly:

byte[] s = 
    "03 02 04 02 0c 02 05 02 2a 02 0e 02 0c 02 05 02 12 02 44 02 03 02 1e 02"
        .Split(' ')
        .Select(x => Convert.ToByte(x, 16))
        .ToArray();

byte[] a1 =
    "C8 83 c8 84 c8 8c c8 85 c8 aa c8 8e c8 8c c8 85 c8 92 c9 84 c8 83 c8 9e"
        .Split(' ')
        .Select(x => Convert.ToByte(x, 16))
        .ToArray();

byte[] new_data = Encoding.UTF8.GetBytes(Encoding.Unicode.GetString(s));

            
Contract.Assert(new_data.SequenceEqual(a1));
`WideCharToMultiByte` with code page `CP_UTF8(0xfde9)` is just converting a __UNICODE-encoded__ byte array to a __UTF8-encoded__ byte array where __UNICODE-encoded__ is actually UTF16-LE-encoded. So the hex string you give ```text 03 02 04 02 0c 02 05 02 2a 02 0e 02 0c 02 05 02 12 02 44 02 03 02 1e 02 ``` is UNICODE-encoded. The correct result ```text C8 83 c8 84 c8 8c c8 85 c8 aa c8 8e c8 8c c8 85 c8 92 c9 84 c8 83 c8 9e ``` is UTF8-encoded. You should decode source hex string in UNICODE and then encode in UTF8, which is quite simple and you don't have to call Win32 API explictly: ```csharp byte[] s = "03 02 04 02 0c 02 05 02 2a 02 0e 02 0c 02 05 02 12 02 44 02 03 02 1e 02" .Split(' ') .Select(x => Convert.ToByte(x, 16)) .ToArray(); byte[] a1 = "C8 83 c8 84 c8 8c c8 85 c8 aa c8 8e c8 8c c8 85 c8 92 c9 84 c8 83 c8 9e" .Split(' ') .Select(x => Convert.ToByte(x, 16)) .ToArray(); byte[] new_data = Encoding.UTF8.GetBytes(Encoding.Unicode.GetString(s)); Contract.Assert(new_data.SequenceEqual(a1)); ```
DeltaFoX commented 2 anni fa
Autore

I thank you for the many things I have learned from you over the years.

I thank you for the many things I have learned from you over the years.
Sign in to join this conversation.
Nessuna etichetta
Nessuna milestone
Nessun assegnatario
2 Partecipanti
Caricamento...
Annulla
Salva
Non ci sono ancora contenuti.