Deathbringer Posted December 8, 2010 Share Posted December 8, 2010 (edited) Edited January 8, 2011 by JosIsaFucktard Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2010 Share Posted December 8, 2010 DllStructSetData($t_ArcNameBufW, 1, $s_File & ChrW(48)) maybe AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2010 Share Posted December 8, 2010 When I read a bit about null terminated strings in C++, I seem to remember you can do it manually by adding a 0/zero to the end of it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MvGulik Posted December 8, 2010 Share Posted December 8, 2010 It this intended? Local $s_File = "D:\Downloads\♥♦♣♠.rar" Local $b_FileName = StringToBinary($s_File & Chr(0)) I mean, I don't see any StringToBinary() flag use so its used in default ANSI. But at the same time your processing a string(filename) that contains UTF characters. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
MvGulik Posted December 8, 2010 Share Posted December 8, 2010 (edited) Ok. Still somewhat mystified. On your.The FileWrites clearly show that while $t_ArcNameBuf is Null terminated, $t_ArcNameBufW is not.I think your making a wrong assumption there. You can't get a [NUL] character back from a DllStruct thats defined with as string-type content like DllStructCreate("wchar[100]"). It will assume the string has ended when it hits that [NUL] byte. Unlike DllStructCreate("byte...) that returns every byte, including the termination [NUL] one. Edited December 8, 2010 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
MvGulik Posted December 8, 2010 Share Posted December 8, 2010 Seems as I expected. Local $s1 = "♥♥♥♥♥♥♥♥" ;; same charcter 8 times. Local $s2 = "♥♦♣♠" ;; your for differant characters. Local $t1 = DllStructCreate("wchar[8]") Local $t2 = DllStructCreate("byte[" & DllStructGetSize($t1) & "]",DllStructGetPtr($t1)) DllStructSetData($t1, 1, $s1) DebugOut('out1', DllStructGetData($t2, 1)) ;### Debug DebugOut. DllStructSetData($t1, 1, $s2) DebugOut('out2', DllStructGetData($t2, 1)) ;### Debug DebugOut. DllStructSetData($t1, 1, $s2 & Chr(0)) ;; Chr(0) == ChrW(0) DebugOut('out3', DllStructGetData($t2, 1)) ;### Debug DebugOut. ;; output: ;; out1 = 0x65266526652665266526652665266526 {bn}(16) [0,0] ;; out2 = 0x65266626632660260000652665266526 {bn}(16) [0,0] ;; auto terminated with [NUL] terminator. ;; out3 = 0x65266626632660260000000065266526 {bn}(16) [0,0] ;; additional [NUL] added as requested.(using my own DebugOut() UDF.) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Ascend4nt Posted December 8, 2010 Share Posted December 8, 2010 It doesn't make sense why you are trying to write NULL characters to an AU3 file. But hey, if you need to write a NULL term or two to a file.. here's one way: $hFile=FileOpen(@DesktopDir&'\test.bin',32+8+2) FileWrite($hFile,"A string"&ChrW(0)&"Another string"&ChrW(0)) FileClose($hFile) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
MvGulik Posted December 8, 2010 Share Posted December 8, 2010 (not at home with utf and such, so no 100% type answers from me here. )If I understand you correctly, then I don't need to manually add a Null character when using a wide-character type (wchar).In general, that seems to be correct yes.Anything that accesses that data automatically knows that the data ends with a Null even though the Null character is not a visible part of the string.With normal use, yes.I may not be explaining it right but the bottom line is that what I am trying to do here is pointless and unnecessary. I did some more testing of wide-character type reading and this seems to be the case.In this case, yes, not needed. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now