WINAMP.COM | Forums > Developer Center > NSIS Discussion > Unicode |
| Pages (9): « First ... « 7 8 [9] |
Last Thread
Next Thread
|
| Author |
|
|
jimpark Senior Member
Registered: Sep 2007 |
For the next release, I plan on adding to pluginapi.h: __________________ |
||
|
|
|
Wizou Senior Member
Registered: Aug 2007 |
@Anders: IsBadReadPtr won't help you here as it will be valid memory range (.bss variables area), just you're not checking a valid Unicode 2nd byte. __________________ |
||
|
|
|
dariann Junior Member
Registered: Mar 2009 |
@jimpark: What about turning on/off "messages about including files" ? NSIS Unicode is great tool and I ask You to add this option, please. |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
Noooooooooo, we don't need a IsUnicodeNSIS() function or any kind of pluginapi helpers to do both. __________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
@Wizou: That's a good point. It's very difficult to write an IsUnicodeNSIS(). The only thing I could do is try validating the string (if anything) to see if it's good UTF16LE. Look in validateunicode.cpp which is in Source. You'll see a class there that can validate UTF16LE/BE as well as UTF8. __________________ |
||
|
|
|
ChocJunkie Member
Registered: Oct 2009 |
Does someone know why I'm always getting empty unicode files when I'm using: code: The source files type is "UTF-16LE|UCS-2LE". -- Problem solved --- I was using Unicode plugin v1.1. I've tried version 1.0 and everything is fine now. Last edited by ChocJunkie on 11-10-2009 at 03:10 PM |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
If we are going to have any chance of a merge, the examples and header files need to be 100% the same, meaning that both the current A and U builds need some changes: __________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
code: When you look at the definition of CreateFile, you see that there really is no function called "CreateFile" but two functions called "CreateFileW" and "CreateFileA." This is true for MOST of the functions that have both the A and the W versions. code: There are functions which only have one name, with no W or A prefixes. So the logic that is in the system plugin currently is to try to load the function with the name as is, then failing that, try to add "W" for the Unicode build (or "A" for the ANSI build) and try again. Unfortunately, for older string functions like lstrlen, the lib you are trying to load DOES have a lstrlen which is ANSI only. It's probably there for backward compatibility since it mimics standard library string functions. So for lstrlen, you need to specify kernel::lstrlenW. But as far as I've seen, it's only these string functions that look and behave like the standard library ones that have this problem. A possible change could be that we always suffix with a "W" or "A" and see if that loads something and try that function first before we try the name of the function unmodified, but I'm uncomfortable with that since I'd rather give the programmer the benefit of the doubt and let him/her decide what s/he really wants to load. I don't mind the plugin second guessing after failures but I don't want it to think it's smarter than the programmer. quote: I agree that we should note that NSIS_MAX_STRLEN is in TCHARS. But going through the documentation, they all state that NSIS_MAX_STRLEN means a number of characters, not bytes. So I'm actually okay with the documentation as-is. As for adding NSIS_MAX_STRCB, I think that's a great idea, although, it can easily be calculated by NSIS_MAX_STRLEN * NSIS_CHAR_SIZE. I like NSIS_MAX_STR_BYTES better as a name, though. Unless the NSIS trunk has NSIS_MAX_STR_BYTES, it would be useless for me to add it just to the Unicode version as it's meant for portability across the two versions. So perhaps we can request NSIS_MAX_STR_BYTES to be added to the NSIS trunk? __________________ |
||
|
|
|
Wizou Senior Member
Registered: Aug 2007 |
For your information, I'm starting to merge Unicode port of NSIS version into NSIS repository. __________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
That's excellent news! Is there an ETA on when this will be complete? __________________ |
||
|
|
|
Wizou Senior Member
Registered: Aug 2007 |
No ETA yet.. I just started the SVN branch I will work on.. __________________ |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
well, if we don't look for "functionW" before "function", we are going to need some kind of define that is "A" or "W" and maybe a list of API's where it is required. IMHO that is the wrong approach, and the reverse is needed, they need to look for the char type specific version first unless a (new) option is provided in the system call __________________ |
||
|
|
|
Wizou Senior Member
Registered: Aug 2007 |
my opinion is to check whether the parameter type contains a "t", then we know we are facing an API which has two variant.. __________________ Last edited by Wizou on 11-17-2009 at 10:16 AM |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
@Wizou: the problem with that check is that if the user calls CreateFile() with 'w' in the Unicode version of NSIS, that's not wrong either. CreateFile should still resolve to CreateFileW. __________________ |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
Windows programmers don't think about that, I'm so used to just calling lstr*, I don't think about the char type. Whats wrong by defaulting to the W versions and only falling back if W does not exists or a option to disable it was set? __________________ |
||
|
|
|
Wizou Senior Member
Registered: Aug 2007 |
__________________ Last edited by Wizou on 11-17-2009 at 03:17 PM |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
Yeah, I agree with Wizou __________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
That would be nice if everyone did that. But remember, when people read the Windows documentation, what do they read? The documentation says to use CreateFile(). It does not say to use CreateFileW() for Unicode. We're just lucky that Microsoft has been largely consistent with these W and A suffixes. __________________ |
||
|
|
|
Pidgeot Senior Member
Registered: Jan 2002 |
To the best of my knowledge, there IS no CreateFile-function, only CreateFileA and CreateFileW. CreateFile is #defined to CreateFileA or CreateFileW in WinBase.h, depending on whether or not UNICODE is defined. |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
__________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
@Pidgeot: Yes, you are right. There is no CreateFile() function in the library you link to. There's a macro. But the documentation tells you to call CreateFile(). __________________ |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
__________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
@Anders: What you say is true. But if you are coding a Unicode only app, you will notice that people use wchar_t with CreateFile() and not CreateFileW(). __________________ |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
but we sort of have to be, in windows/C world, this stuff happens at compile time, for us it happens at runtime, and so, t is our clue that the user trusts us and expects us to the right thing __________________ |
||
|
|
|
jimpark Senior Member
Registered: Sep 2007 |
Unfortunately, my access to the internet is very limited. So I can't IRC. This is also what keeps me from being able to work on the NSIS repository directly (and hence that's why I haven't created a branch in the repository for my stuff here). So once the group actually takes my code into the repository, I can't work on it anymore. Anyway, that's my situation and will be for the foreseeable future. __________________ |
||
|
|
|
Anders Major Dude
Registered: Jun 2002 |
Well, there are HTTP IRC "clients" that work just fine, try mibbit __________________ |
||
|
|
|
Wizou Senior Member
Registered: Aug 2007 |
You are both right... __________________ |
||
|
|
|
| Pages (9): « First ... « 7 8 [9] |
Last Thread Next Thread
|
WINAMP.COM | Forums > Developer Center > NSIS Discussion > Unicode |
Forum Rules:
|