763c817c7f4e058ffc7d193a22607ebffc57c986
2 * PROJECT: ReactOS Automatic Testing Utility
3 * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
4 * PURPOSE: Various helper functions
5 * COPYRIGHT: Copyright 2008-2009 Colin Finck <colin@reactos.org>
11 * Escapes a string according to RFC 1738.
12 * Required for passing parameters to the web service.
15 * Pointer to a CHAR array, which will receive the escaped string.
16 * The output buffer must be large enough to hold the full escaped string. You're on the safe side
17 * if you make the output buffer three times as large as the input buffer.
20 * Pointer to a CHAR array, which contains the input buffer to escape.
23 EscapeString(PCHAR Output
, PCHAR Input
)
25 const CHAR HexCharacters
[] = "0123456789ABCDEF";
29 if(strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~", *Input
) )
31 /* It's a character we don't need to escape, just add it to the output string */
36 /* We need to escape this character */
38 *Output
++ = HexCharacters
[((UCHAR
)*Input
>> 4) % 16];
39 *Output
++ = HexCharacters
[(UCHAR
)*Input
% 16];
47 * Outputs a string through the standard output and the debug output.
50 * The string to output
53 StringOut(PCHAR String
)
56 OutputDebugStringA(String
);