Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #8088 > unrolled thread
| Started by | Martin <Martin@spam.spam> |
|---|---|
| First post | 2015-05-12 14:56 +0100 |
| Last post | 2015-05-12 23:45 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Hunting for 5333 Martin <Martin@spam.spam> - 2015-05-12 14:56 +0100
Re: Hunting for 5333 "Wolfgang Riedmann" <wriedmann@gmail.com> - 2015-05-12 16:31 +0200
Re: Hunting for 5333 Mathias <mathias.hakansson@consultec.se> - 2015-05-12 23:45 -0700
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2015-05-12 14:56 +0100 |
| Subject | Hunting for 5333 |
| Message-ID | <mit0oc$9id$1@dont-email.me> |
Hello
Still getting the odd 5333 crash and I want to know the correct way to
handle zero terminated strings PSZ
This is just about the only thing I have left to investigate
Examples of code found
DirMake(String2Psz('C:\FILEPATH'))
ShellExecute(SELF:Handle(),PSZ("open"),PSZ(CHR(34)+cURL+CHR(34)),PSZ(""),PSZ(""),SW_SHOWNORMAL)
Thanks
Martin
[toc] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2015-05-12 16:31 +0200 |
| Message-ID | <creh6vFnd6hU1@mid.individual.net> |
| In reply to | #8088 |
Hi Martin,
to be safe, I would use always String2PSZ().
From the help:
"String2Psz() is useful for many Windows or DLL functions that require
a PSZ in their argument list. It checks whether <cString> is a
NULL_STRING. If this is the case, String2Psz() returns a static
pointer to a byte containing 0x00.
Otherwise, it allocates a buffer within static memory, copies the
string content to it, and returns the pointer to this buffer. The
pointer becomes a hidden local variable. If the appropriate function
or method, which called String2Psz(), goes out of scope, the allocated
buffer will be freed up automatically. Furthermore, the pointer is no
longer valid"
This is so since the early days of VO 2.8, I think.
And at least in my code, 5333s are very, very rare now.
Wolfgang
> Hello
>
> Still getting the odd 5333 crash and I want to know the correct way
> to handle zero terminated strings PSZ
>
> This is just about the only thing I have left to investigate
>
>
> Examples of code found
>
> DirMake(String2Psz('C:\FILEPATH'))
>
> ShellExecute(SELF:Handle(),PSZ("open"),PSZ(CHR(34)+cURL+CHR(34)),PSZ("
> "),PSZ(""),SW_SHOWNORMAL)
>
> Thanks
>
> Martin
--
[toc] | [prev] | [next] | [standalone]
| From | Mathias <mathias.hakansson@consultec.se> |
|---|---|
| Date | 2015-05-12 23:45 -0700 |
| Message-ID | <29d3d65c-32da-4285-b791-b940bf7c85c3@googlegroups.com> |
| In reply to | #8089 |
Hi all,
I would say that type converstion is ok with literals as they don't move in memory;
DirMake(Psz('C:\FILEPATH'))
You should not use pointers to strings in dynamic memory so your ShellExecute statement should be.
ShellExecute(SELF:Handle(),PSZ("open"), String2Psz(CHR(34) + cURL + CHR(34)),PSZ(""), PSZ(""), SW_SHOWNORMAL)
/Mathias
Den tisdag 12 maj 2015 kl. 16:32:01 UTC+2 skrev Wolfgang Riedmann:
> Hi Martin,
>
> to be safe, I would use always String2PSZ().
>
> From the help:
>
> "String2Psz() is useful for many Windows or DLL functions that require
> a PSZ in their argument list. It checks whether <cString> is a
> NULL_STRING. If this is the case, String2Psz() returns a static
> pointer to a byte containing 0x00.
>
> Otherwise, it allocates a buffer within static memory, copies the
> string content to it, and returns the pointer to this buffer. The
> pointer becomes a hidden local variable. If the appropriate function
> or method, which called String2Psz(), goes out of scope, the allocated
> buffer will be freed up automatically. Furthermore, the pointer is no
> longer valid"
>
> This is so since the early days of VO 2.8, I think.
>
> And at least in my code, 5333s are very, very rare now.
>
> Wolfgang
>
>
> > Hello
> >
> > Still getting the odd 5333 crash and I want to know the correct way
> > to handle zero terminated strings PSZ
> >
> > This is just about the only thing I have left to investigate
> >
> >
> > Examples of code found
> >
> > DirMake(String2Psz('C:\FILEPATH'))
> >
> > ShellExecute(SELF:Handle(),PSZ("open"),PSZ(CHR(34)+cURL+CHR(34)),PSZ("
> > "),PSZ(""),SW_SHOWNORMAL)
> >
> > Thanks
> >
> > Martin
>
>
>
> --
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web