static char AFSConfigKeyName[] = AFSREG_CLT_SVC_PARAM_SUBKEY;
+static const char utf8_prefix[] = UTF8_PREFIX;
+static const int utf8_prefix_size = sizeof(utf8_prefix) - sizeof(char);
+
#define FS_IOCTLREQUEST_MAXSIZE 8192
/* big structure for representing and storing an IOCTL request */
typedef struct fs_ioctlRequest {
/* includes marshalling NULL pointer as a null (0 length) string */
static long
-MarshallString(fs_ioctlRequest_t * reqp, char *stringp)
+MarshallString(fs_ioctlRequest_t * reqp, char *stringp, int is_utf8)
{
int count;
else
count = 1;
+ if (is_utf8) {
+ count += utf8_prefix_size;
+ }
+
/* watch for buffer overflow */
if ((reqp->mp - reqp->data) + count > sizeof(reqp->data)) {
if ( IoctlDebug() )
return -1;
}
+ if (is_utf8) {
+ memcpy(reqp->mp, utf8_prefix, utf8_prefix_size);
+ reqp->mp += utf8_prefix_size;
+ count -= utf8_prefix_size;
+ }
+
if (stringp)
memcpy(reqp->mp, stringp, count);
else
return 0;
}
-long
-pioctl(char *pathp, long opcode, struct ViceIoctl *blobp, int follow)
+static long
+pioctl_int(char *pathp, long opcode, struct ViceIoctl *blobp, int follow, int is_utf8)
{
fs_ioctlRequest_t preq;
long code;
strcpy(fullPath, "");
}
- MarshallString(&preq, fullPath);
+ MarshallString(&preq, fullPath, is_utf8);
if (blobp->in_size) {
if (blobp->in_size > sizeof(preq.data) - (preq.mp - preq.data)*sizeof(char)) {
errno = E2BIG;
CloseHandle(reqHandle);
return 0;
}
+
+long
+pioctl_utf8(char * pathp, long opcode, struct ViceIoctl * blobp, int follow)
+{
+ return pioctl_int(pathp, opcode, blobp, follow, TRUE);
+}
+
+long
+pioctl(char * pathp, long opcode, struct ViceIoctl * blobp, int follow)
+{
+ return pioctl_int(pathp, opcode, blobp, follow, FALSE);
+}
+