/*----------------------------------------------------------------------* rtp_wfile_get_name *----------------------------------------------------------------------*/ int rtp_wfile_get_name (void * dirobj, unsigned short * name, int size) { #if (_WIN32_WINNT) >= 0x0400 unsigned int sizelimit; #ifdef RTP_DEBUG SetLastError (0); #endif if (!dirobj) { #ifdef RTP_DEBUG SetLastError(ERROR_INVALID_HANDLE); RTP_DEBUG_OUTPUT_ERRNO("rtp_wfile_get_name:"); #endif return (-1); } sizelimit = wcslen(((WFSOBJ *)dirobj)->fsObject.name); if (size > 0) { if (sizelimit > (unsigned int)(size - 1)) { sizelimit = size - 1; } } wcsncpy(name, (const unsigned short *) (((WFSOBJ *)dirobj)->fsObject.name), sizelimit); name[sizelimit] = '\0'; name = _rtp_unicode_winname_to_name(name); return (0); #endif return (-1); }
/*----------------------------------------------------------------------* rtp_wfile_pwd *----------------------------------------------------------------------*/ int rtp_wfile_pwd (unsigned short * name, long size) { #if (_WIN32_WINNT) >= 0x0400 #ifdef RTP_DEBUG int result; /* ----------------------------------- */ /* Clear the error state by setting */ /* to 0. */ /* ----------------------------------- */ SetLastError (0); #endif if (_wgetcwd (name, (int)size) == NULL) { #ifdef RTP_DEBUG result = GetLastError(); RTP_DEBUG_OUTPUT_STR("rtp_wfile_pwd: error returned "); RTP_DEBUG_OUTPUT_INT(result); RTP_DEBUG_OUTPUT_STR(".\n"); #endif return (-1); } name = _rtp_unicode_winname_to_name (name); return (0); #endif return (-1); }
/*----------------------------------------------------------------------* rtp_wfile_get_name *----------------------------------------------------------------------*/ int rtp_wfile_get_name (void * dirobj, unsigned short * name, int size) { #if (_WIN32_WINNT) >= 0x0400 unsigned int sizelimit; #ifdef RTP_DEBUG int result; /* ----------------------------------- */ /* Clear the error state by setting */ /* to 0. */ /* ----------------------------------- */ SetLastError (0); #endif if (!dirobj) { #ifdef RTP_DEBUG SetLastError(ERROR_INVALID_HANDLE); result = GetLastError(); RTP_DEBUG_OUTPUT_STR("rtp_wfile_get_name: error returned "); RTP_DEBUG_OUTPUT_INT(result); RTP_DEBUG_OUTPUT_STR(".\n"); #endif return (-1); } sizelimit = wcslen(((WFSOBJ *)dirobj)->fsObject.name); if (size > 0) { if (sizelimit > (unsigned int)(size - 1)) { sizelimit = size - 1; } } wcsncpy(name, (const unsigned short *) (((WFSOBJ *)dirobj)->fsObject.name), sizelimit); name[sizelimit] = '\0'; name = _rtp_unicode_winname_to_name(name); return (0); #endif return (-1); }
/*----------------------------------------------------------------------* rtp_wfile_pwd *----------------------------------------------------------------------*/ int rtp_wfile_pwd (unsigned short * name, long size) { #if (_WIN32_WINNT) >= 0x0400 #ifdef RTP_DEBUG SetLastError (0); #endif if (_wgetcwd (name, (int)size) == NULL) { #ifdef RTP_DEBUG RTP_DEBUG_OUTPUT_ERRNO("rtp_wfile_pwd:"); #endif return (-1); } name = _rtp_unicode_winname_to_name (name); return (0); #endif return (-1); }