-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode compatibility on Windows #7235
Comments
@xarkes just in case you haven't seen this. :) |
Apply this changes (convert from ANSI to UNICODE) have an impact in radare core functions (you must convert types and functions aka char *to wchar_t, fgets to fgetws...etc): For example:
I think that we have to decide which radare functions pass to unicode before perform this task. For example:
|
No, you should convert to utf8 and only when close to the winapi convert to
wchar, see utf8everywhere.org
…On Wed, 18 Oct 2017 at 18:35, josediazfer ***@***.***> wrote:
Apply this changes (convert from ANSI to UNICODE) have an impact in radare
core functions (you must convert types and functions aka char *to wchar_t,
fgets to fgetws...etc):
For example:
R_API bool r_sys_mkdir(const char *dir) {
if (r_sandbox_enable (0)) {
return false;
}
#if __WINDOWS__ && !defined(__CYGWIN__)
return CreateDirectory (dir, NULL) != 0;
#else
return mkdir (dir, 0755) != -1;
#endif
}
I think that we have to decide which radare functions pass to unicode
before perform this task.
When we have that functions to change then progressively make changes:
For example:
- First step:
R_API bool r_sys_mkdir(const char *dir) {
if (r_sandbox_enable (0)) {
return false;
}
#if __WINDOWS__ && !defined(__CYGWIN__)
wchar_t *wdir = char2wchar(dir);
return CreateDirectory (wdir, NULL) != 0;
#else
return mkdir (dir, 0755) != -1;
#endif
}
- Second step:
R_API bool r_sys_mkdir(const wchar_t *dir) {
if (r_sandbox_enable (0)) {
return false;
}
#if __WINDOWS__ && !defined(__CYGWIN__)
return CreateDirectory (dir, NULL) != 0;
#else
return mkdir (dir, 0755) != -1;
#endif
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7235 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWCmYYbGsxT5RTu03OIhnaHdWiPj0aWks5stijtgaJpZM4M4oQe>
.
|
it's true, you're right. Its not need change "dir" parameter to wchar type and it's not good idea. I'm not sure if we need use SetConsoleOutputCP(CP_UTF8) SetConsoleCP(CP_UTF8) and MultiByteToWideChar() (utf-8 to wchar), I will research it tomorrow. |
I've already made the changes. (https://github.com/josediazfer/radare2/tree/win32_char_to_unicode) Comments and suggestions are welcome |
Please do a Pull request not this. |
@josediazfer @mrexodia so, can be this closed? |
Yes can be closed it |
Ehm? I don't think that PR was merged |
👍
…On Fri, 3 Nov 2017 at 18:55 Maijin ***@***.***> wrote:
527ff71
<527ff71>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7235 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWCmeJ_ZhVQXJ3wId4t0iLi03zqV4LAks5sy1OZgaJpZM4M4oQe>
.
|
Make sure to check if these are still the case. They are hardlinked to a specific commit.
Currently quite a lot of Windows APIs called use the ANSI version of the API is used which means r2 won't work on unicode paths etc. I will add an exhaustive list of all the places here later.
ADVAPI32.dll
CreateServiceA
LookupPrivilegeValueA
OpenSCManagerA
OpenServiceA
StartServiceA
KERNEL32.dll
CreateDirectoryA
CreateFileA
CreateFileMappingA
CreateNamedPipeA
CreateProcessA
DeleteFileA
FillConsoleOutputCharacterA
FormatMessageA
GetEnvironmentVariableA
GetLogicalDriveStringsA
GetModuleFileNameA
GetModuleHandleA
GetShortPathNameA
GetTempFileNameA
LoadLibraryA
lstrlenA
MoveFileExA
QueryDosDeviceA
QueryFullProcessImageNameA
ReadConsoleInputA
RemoveDirectoryA
SetEnvironmentVariableA
USER32.dll
GetClipboardData
The text was updated successfully, but these errors were encountered: