本文整理汇总了C++中GetFullPathNameW函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFullPathNameW函数的具体用法?C++ GetFullPathNameW怎么用?C++ GetFullPathNameW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFullPathNameW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Normalize
plFileName plFileName::AbsolutePath() const
{
if (!IsValid())
return *this;
plFileName path = Normalize();
#if HS_BUILD_FOR_WIN32
plStringBuffer<wchar_t> wideName = path.fName.ToWchar();
wchar_t path_sm[MAX_PATH];
uint32_t path_length = GetFullPathNameW(wideName, MAX_PATH, path_sm, nullptr);
if (path_length >= MAX_PATH) {
// Buffer not big enough
wchar_t *path_lg = new wchar_t[path_length];
GetFullPathNameW(wideName, path_length, path_lg, nullptr);
path = plString::FromWchar(path_lg);
delete [] path_lg;
} else {
path = plString::FromWchar(path_sm);
}
#else
char *path_a = realpath(path.fName.c_str(), nullptr);
hsAssert(path_a, "Failure to get absolute path (unsupported libc?)");
path = path_a;
free(path_a);
#endif
return path;
}
开发者ID:Filtik,项目名称:Plasma,代码行数:29,代码来源:plFileSystem.cpp
示例2: g_malloc
static struct filename_representations
*filename_representations_new(const char *raw, int type)
{
struct filename_representations *fr;
char *display_pre;
char *real_path;
#ifdef G_OS_WIN32
DWORD buffer_length;
gunichar2 *raw_utf16, *real_path_utf16;
#endif
fr = g_malloc(sizeof(struct filename_representations));
fr->type = type;
fr->raw = g_strdup(raw);
#ifdef G_OS_WIN32
raw_utf16 = g_utf8_to_utf16(fr->raw, -1, NULL, NULL, NULL);
buffer_length = GetFullPathNameW(raw_utf16, 0, NULL, NULL);
real_path_utf16 = g_malloc(buffer_length * sizeof(gunichar2));
GetFullPathNameW(raw_utf16, buffer_length, real_path_utf16, NULL);
real_path = g_utf16_to_utf8(raw_utf16, -1, NULL, NULL, NULL);
g_free(real_path_utf16);
g_free(raw_utf16);
#else
real_path = realpath(fr->raw, NULL);
#endif
display_pre = g_filename_display_name(real_path);
fr->collate_key = g_utf8_collate_key_for_filename(display_pre, -1);
fr->display = g_strescape(display_pre,
(const gchar *) strescape_exceptions);
g_free(display_pre);
g_free(real_path);
return fr;
}
开发者ID:jiixyj,项目名称:filewalk,代码行数:35,代码来源:filetree.c
示例3: PutFilePathName1017
bool PutFilePathName1017(UnicodeFileName* aFullName, const wchar_t* pFileName)
{
wchar_t* pFullName = aFullName->GetBuffer(MAX_PIC_PATH_LEN);
wchar_t sFullName[MAX_PATH*2], *pszPart=NULL;
DWORD nCount = sizeof(sFullName)/sizeof(sFullName[0]);
bool result = false;
DWORD nLen = GetFullPathNameW(pFileName, nCount, sFullName, &pszPart);
if (!nLen)
return false; // не смогли?
if (nLen > nCount) {
wchar_t* pszBuffer = (wchar_t*)malloc(nLen * sizeof(wchar_t));
_ASSERTE(pszBuffer);
nLen = GetFullPathNameW(pFileName, nLen, pszBuffer, &pszPart);
if (nLen) {
aFullName->Assign(pszBuffer);
result = true;
}
free(pszBuffer);
} else {
aFullName->Assign(sFullName);
result = true;
}
return result;
}
开发者ID:FarManagerLegacy,项目名称:PicView,代码行数:27,代码来源:Plugin1017.cpp
示例4: get_full_path_name
wstring get_full_path_name(const wstring& path) {
Buffer<wchar_t> buf(MAX_PATH);
DWORD size = GetFullPathNameW(path.c_str(), static_cast<DWORD>(buf.size()), buf.data(), nullptr);
if (size > buf.size()) {
buf.resize(size);
size = GetFullPathNameW(path.c_str(), static_cast<DWORD>(buf.size()), buf.data(), nullptr);
}
CHECK_SYS(size);
return wstring(buf.data(), size);
}
开发者ID:landswellsong,项目名称:FAR,代码行数:10,代码来源:sysutils.cpp
示例5: make_absolute_and_transform_to_utf8_and_make_vpath
static
rc_t make_absolute_and_transform_to_utf8_and_make_vpath ( const VFSManager * self,
VPath ** new_path, const wchar_t * src, bool have_drive )
{
rc_t rc;
wchar_t full [ 4096 ];
/* expand to full path - this is temporary, and will be replaced after KFS is updated */
DWORD len = GetFullPathNameW ( src, sizeof full / sizeof full [ 0 ], full, NULL );
if ( len == 0 )
{
/* we have an error */
DWORD status = GetLastError ();
DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "GetFullPathNameW: error code - %u.\n", status ) );
rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
}
else if ( len >= sizeof full / sizeof full [ 0 ] )
{
/* the buffer is too small ! */
wchar_t * big_buf = malloc( ( ++len ) * ( sizeof full[ 0 ] ) );
if ( big_buf == NULL )
rc = RC ( rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted );
else
{
DWORD len2 = GetFullPathNameW ( src, len, big_buf, NULL );
if ( len2 == 0 )
{
/* we have an error */
DWORD status = GetLastError ();
DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "GetFullPathNameW: error code - %u.\n", status ) );
rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
}
else if ( len2 >= len )
{
DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "GetFullPathNameW: buffer too small again - %u.\n", len2 ) );
rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
}
else
{
/* now we can call the final transform and make */
rc = transform_to_utf8_and_make_vpath( self, new_path, big_buf, true );
}
free( big_buf );
}
}
else
{
/* now we can call the final transform and make */
rc = transform_to_utf8_and_make_vpath( self, new_path, full, true );
}
return rc;
}
开发者ID:binlu1981,项目名称:ncbi-vdb,代码行数:52,代码来源:syspath.c
示例6: RTDECL
/**
* Get the real (no symlinks, no . or .. components) path, must exist.
*
* @returns iprt status code.
* @param pszPath The path to resolve.
* @param pszRealPath Where to store the real path.
* @param cchRealPath Size of the buffer.
*/
RTDECL(int) RTPathReal(const char *pszPath, char *pszRealPath, size_t cchRealPath)
{
/*
* Convert to UTF-16, call Win32 APIs, convert back.
*/
PRTUTF16 pwszPath;
int rc = RTStrToUtf16(pszPath, &pwszPath);
if (!RT_SUCCESS(rc))
return (rc);
LPWSTR lpFile;
WCHAR wsz[RTPATH_MAX];
rc = GetFullPathNameW((LPCWSTR)pwszPath, RT_ELEMENTS(wsz), &wsz[0], &lpFile);
if (rc > 0 && rc < RT_ELEMENTS(wsz))
{
/* Check that it exists. (Use RTPathAbs() to just resolve the name.) */
DWORD dwAttr = GetFileAttributesW(wsz);
if (dwAttr != INVALID_FILE_ATTRIBUTES)
rc = RTUtf16ToUtf8Ex((PRTUTF16)&wsz[0], RTSTR_MAX, &pszRealPath, cchRealPath, NULL);
else
rc = RTErrConvertFromWin32(GetLastError());
}
else if (rc <= 0)
rc = RTErrConvertFromWin32(GetLastError());
else
rc = VERR_FILENAME_TOO_LONG;
RTUtf16Free(pwszPath);
return rc;
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:39,代码来源:path-win.cpp
示例7: absolute_path
static std::string absolute_path(const std::string &path) {
std::wstring wpath = transcode_utf8_to_utf16(path);
wchar_t buf[MAX_PATH+1];
DWORD len = GetFullPathNameW(wpath.c_str(), MAX_PATH, buf, 0);
buf[len] = L'\0';
return transcode_utf16_to_utf8(buf, len);
}
开发者ID:RevReese,项目名称:pioneer-sp,代码行数:7,代码来源:FileSystemWin32.cpp
示例8: ConvertToNtPath
bool ConvertToNtPath(const wchar_t* path, wchar_t* normalized, size_t normalizedLen)
{
UNICODE_STRING ntPath;
DWORD size;
bool result = false;
size = GetFullPathNameW(path, (DWORD)normalizedLen, normalized, NULL);
if (size == 0)
return false;
memset(&ntPath, 0, sizeof(ntPath));
if (RtlDosPathNameToRelativeNtPathName_U(normalized, &ntPath, NULL, NULL) == FALSE)
return false;
if (normalizedLen * sizeof(wchar_t) > ntPath.Length)
{
memcpy(normalized, ntPath.Buffer, ntPath.Length);
normalized[ntPath.Length / sizeof(wchar_t)] = L'\0';
result = true;
}
HeapFree(GetProcessHeap(), 0, ntPath.Buffer);
return result;
}
开发者ID:JKornev,项目名称:hidden,代码行数:26,代码来源:HiddenLib.cpp
示例9: cmdLogFile
void cmdLogFile(int argc, wchar_t** argv)
{
TurnOffLogFile();
const wchar_t* fileName = L"HeapMonitorTrace.log";
if (argc >= 1)
{
// turn off
if (_wcsicmp(argv[0], L"off") == 0)
{
wprintf(L"LogFile is turned off\n");
return;
}
else
{
fileName = argv[0];
}
}
g_logFile = CreateFileW(fileName, GENERIC_WRITE, FILE_SHARE_READ, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (g_logFile == INVALID_HANDLE_VALUE) {
wprintf(L"Cannot open LogFile %ls\n", fileName);
return;
}
SetFilePointer(g_logFile, 0, NULL, FILE_END);
wchar_t fullName[MAX_PATH] = { 0 };
wchar_t *pszFilePart = NULL;
GetFullPathNameW(fileName, MAX_PATH, fullName, &pszFilePart);
wprintf(L"LogFile is turned on, File=%ls\n", fullName);
}
开发者ID:someonegg,项目名称:heap_monitor,代码行数:33,代码来源:hmonitor_etw.cpp
示例10: GetFullPathNameW
bool FolderBrowserDialog::SetBufFromDir(const wchar_t * src, wchar_t* buf, int blen)
{
DWORD retlen = GetFullPathNameW(src, blen, buf, NULL);
if (retlen && retlen < MAX_WPATH && PathIsDirectoryW(buf))
return true;
return false;
}
开发者ID:res2001,项目名称:BrowseFolder,代码行数:7,代码来源:FolderBrowserDialog.cpp
示例11: stat_dev_for
static dev_t stat_dev_for(const wchar_t *wpathname)
{
DWORD len;
wchar_t *fullpath;
len = GetFullPathNameW(wpathname, 0, NULL, NULL);
fullpath = __builtin_alloca((len + 1) * sizeof(wchar_t));
if(!GetFullPathNameW(wpathname, len, fullpath, NULL)) {
fprintf(stderr, "tup error: GetFullPathNameW(\"%ls\") failed: 0x%08lx\n", wpathname, GetLastError());
return 0;
}
if(fullpath[1] != L':') {
return 0;
}
return fullpath[0] - L'A';
}
开发者ID:erikbrinkman,项目名称:tup,代码行数:16,代码来源:lstat.c
示例12: utf8to16String
result_t path_base::fullpath(exlib::string path, exlib::string &retVal)
{
#ifdef _WIN32
exlib::wstring str = utf8to16String(path);
exlib::wchar utf16_buffer[MAX_PATH];
DWORD utf16_len = GetFullPathNameW(str.c_str(), MAX_PATH, utf16_buffer, NULL);
if (!utf16_len)
return CHECK_ERROR(LastError());
retVal = utf16to8String(utf16_buffer, (int32_t)utf16_len);
return 0;
#else
if (isPathSlash(path.c_str()[0]))
return normalize(path, retVal);
exlib::string str;
process_base::cwd(str);
str.append(1, PATH_SLASH);
str.append(path);
return normalize(str, retVal);
#endif
}
开发者ID:anlebcoder,项目名称:fibjs,代码行数:25,代码来源:path.cpp
示例13: SIC_GetIconIndex
/*****************************************************************************
* SIC_GetIconIndex [internal]
*
* Parameters
* sSourceFile [IN] filename of file containing the icon
* index [IN] index/resID (negated) in this file
*
* NOTES
* look in the cache for a proper icon. if not available the icon is taken
* from the file and cached
*/
INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags )
{
SIC_ENTRY sice;
INT ret, index = INVALID_INDEX;
WCHAR path[MAX_PATH];
TRACE("%s %i\n", debugstr_w(sSourceFile), dwSourceIndex);
GetFullPathNameW(sSourceFile, MAX_PATH, path, NULL);
sice.sSourceFile = path;
sice.dwSourceIndex = dwSourceIndex;
sice.dwFlags = dwFlags;
EnterCriticalSection(&SHELL32_SicCS);
if (NULL != DPA_GetPtr (sic_hdpa, 0))
{
/* search linear from position 0*/
index = DPA_Search (sic_hdpa, &sice, 0, SIC_CompareEntries, 0, DPAS_SORTED);
}
if ( INVALID_INDEX == index )
{
ret = SIC_LoadIcon (sSourceFile, dwSourceIndex, dwFlags);
}
else
{
TRACE("-- found\n");
ret = ((LPSIC_ENTRY)DPA_GetPtr(sic_hdpa, index))->dwListIndex;
}
LeaveCriticalSection(&SHELL32_SicCS);
return ret;
}
开发者ID:GYGit,项目名称:reactos,代码行数:45,代码来源:iconcache.cpp
示例14: dllGetFullPathNameW
extern "C" DWORD WINAPI dllGetFullPathNameW(LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart)
{
#ifdef TARGET_WINDOWS
if (!lpFileName) return 0;
if(wcsstr(lpFileName, L"://"))
{
size_t length = wcslen(lpFileName);
if (nBufferLength < (length + 1))
return length + 1;
else
{
wcscpy(lpBuffer, lpFileName);
if(lpFilePart)
{
wchar_t* s1 = wcsrchr(lpBuffer, '\\');
wchar_t* s2 = wcsrchr(lpBuffer, '/');
if(s2 && s1 > s2)
*lpFilePart = s1 + 1;
else if(s1 && s2 > s1)
*lpFilePart = s2 + 1;
else
*lpFilePart = lpBuffer;
}
return length;
}
}
return GetFullPathNameW(lpFileName, nBufferLength, lpBuffer, lpFilePart);
#else
not_implement("kernel32.dll fake function GetFullPathNameW called\n"); //warning
return 0;
#endif
}
开发者ID:Karlson2k,项目名称:xbmc,代码行数:32,代码来源:emu_kernel32.cpp
示例15: gitwin_to_utf16
char *p_realpath(const char *orig_path, char *buffer)
{
int ret;
wchar_t* orig_path_w = gitwin_to_utf16(orig_path);
wchar_t* buffer_w = (wchar_t*)git__malloc(GIT_PATH_MAX * sizeof(wchar_t));
ret = GetFullPathNameW(orig_path_w, GIT_PATH_MAX, buffer_w, NULL);
git__free(orig_path_w);
if (!ret || ret > GIT_PATH_MAX) {
buffer = NULL;
goto done;
}
if (buffer == NULL) {
int buffer_sz = WideCharToMultiByte(CP_UTF8, 0, buffer_w, -1, NULL, 0, NULL, NULL);
if (!buffer_sz ||
!(buffer = (char *)git__malloc(buffer_sz)) ||
!WideCharToMultiByte(CP_UTF8, 0, buffer_w, -1, buffer, buffer_sz, NULL, NULL))
{
git__free(buffer);
buffer = NULL;
}
} else {
if (!WideCharToMultiByte(CP_UTF8, 0, buffer_w, -1, buffer, GIT_PATH_MAX, NULL, NULL))
buffer = NULL;
}
done:
git__free(buffer_w);
if (buffer)
git_path_mkposix(buffer);
return buffer;
}
开发者ID:gitpan,项目名称:Git-XS,代码行数:35,代码来源:posix_w32.c
示例16: ConvertNameToFull
void ConvertNameToFull(const wchar *Src,wchar *Dest)
{
if (Src==NULL || *Src==0)
{
*Dest=0;
return;
}
#ifdef _WIN_32
if (WinNT())
{
wchar FullName[NM],*NamePtr;
if (GetFullPathNameW(Src,sizeof(FullName)/sizeof(FullName[0]),FullName,&NamePtr))
strcpyw(Dest,FullName);
else
if (Src!=Dest)
strcpyw(Dest,Src);
}
else
{
char AnsiName[NM];
WideToChar(Src,AnsiName);
ConvertNameToFull(AnsiName,AnsiName);
CharToWide(AnsiName,Dest);
}
#else
char AnsiName[NM];
WideToChar(Src,AnsiName);
ConvertNameToFull(AnsiName,AnsiName);
CharToWide(AnsiName,Dest);
#endif
}
开发者ID:zachberger,项目名称:UnRarX,代码行数:31,代码来源:filefn.cpp
示例17: SheChangeDirW
INT
SheChangeDirW(
register WCHAR *newdir
)
{
WCHAR denvname[ 4 ];
WCHAR newpath[ MAX_PATH ];
WCHAR denvvalue[ MAX_PATH ];
WCHAR c, *s;
DWORD attr;
GetCurrentDirectoryW( MAX_PATH, denvvalue );
c = (WCHAR)(DWORD)CharUpperW((LPTSTR)(DWORD)denvvalue[0]);
denvname[0] = WCHAR_EQUAL;
if (IsCharAlphaW(*newdir) && newdir[1] == WCHAR_COLON) {
denvname[1] = (WCHAR)(DWORD)CharUpperW((LPTSTR)(DWORD)*newdir);
newdir += 2;
} else {
denvname[ 1 ] = c;
}
denvname[ 2 ] = WCHAR_COLON;
denvname[ 3 ] = WCHAR_NULL;
if ((*newdir == WCHAR_BSLASH) || (*newdir == WCHAR_SLASH)) {
newpath[ 0 ] = denvname[ 1 ];
newpath[ 1 ] = denvname[ 2 ];
wcscpy( &newpath[ 2 ], newdir );
} else {
if (NULL != (s = SheGetEnvVarW( denvname ))) {
wcscpy( newpath, s );
} else {
newpath[ 0 ] = denvname[ 1 ];
newpath[ 1 ] = denvname[ 2 ];
newpath[ 2 ] = WCHAR_NULL;
}
s = newpath + wcslen( newpath );
*s++ = WCHAR_BSLASH;
wcscpy( s, newdir );
}
if (!GetFullPathNameW(newpath, MAX_PATH, denvvalue, &s )) {
return( ERROR_ACCESS_DENIED );
}
attr = GetFileAttributesW( denvvalue );
if (attr == -1 || !(attr & FILE_ATTRIBUTE_DIRECTORY)) {
return( ERROR_ACCESS_DENIED );
}
if (SheSetEnvVarW(denvname,denvvalue)) {
return( ERROR_NOT_ENOUGH_MEMORY );
}
SetCurrentDirectoryW( denvvalue );
// this seems wrong... SheGetDir(GD_DEFAULT, CurDrvDirW) ;
wcscpy(CurDrvDirW, denvvalue); // this seems right to me.
return(SUCCESS) ;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:60,代码来源:psdocurd.c
示例18: MSVCRT__wgetdcwd
/*********************************************************************
* _wgetdcwd ([email protected])
*
* Unicode version of _wgetdcwd.
*/
MSVCRT_wchar_t* CDECL MSVCRT__wgetdcwd(int drive, MSVCRT_wchar_t * buf, int size)
{
static MSVCRT_wchar_t* dummy;
TRACE(":drive %d(%c), size %d\n",drive, drive + 'A' - 1, size);
if (!drive || drive == MSVCRT__getdrive())
return MSVCRT__wgetcwd(buf,size); /* current */
else
{
MSVCRT_wchar_t dir[MAX_PATH];
MSVCRT_wchar_t drivespec[4] = {'A', ':', '\\', 0};
int dir_len;
drivespec[0] += drive - 1;
if (GetDriveTypeW(drivespec) < DRIVE_REMOVABLE)
{
*MSVCRT__errno() = MSVCRT_EACCES;
return NULL;
}
dir_len = GetFullPathNameW(drivespec,MAX_PATH,dir,&dummy);
if (dir_len >= size || dir_len < 1)
{
*MSVCRT__errno() = MSVCRT_ERANGE;
return NULL; /* buf too small */
}
TRACE(":returning %s\n", debugstr_w(dir));
if (!buf)
return MSVCRT__wcsdup(dir); /* allocate */
strcpyW(buf,dir);
}
return buf;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:40,代码来源:dir.c
示例19: FSusesLocalTimeW
local int FSusesLocalTimeW(const wchar_t *path)
{
wchar_t *tmp0;
wchar_t rootPathName[4];
wchar_t tmp1[MAX_PATH], tmp2[MAX_PATH];
DWORD volSerNo, maxCompLen, fileSysFlags;
#if defined(__RSXNT__) /* RSXNT/EMX C rtl uses OEM charset */
wchar_t *ansi_path = (wchar_t *)alloca((wcslen(path) + 1) * sizeof(wchar_t));
CharToAnsiW(path, ansi_path);
path = ansi_path;
#endif
if (iswalpha(path[0]) && (path[1] == (wchar_t)':'))
tmp0 = (wchar_t *)path;
else
{
GetFullPathNameW(path, MAX_PATH, tmp1, &tmp0);
tmp0 = &tmp1[0];
}
wcsncpy(rootPathName, tmp0, 3); /* Build the root path name, */
rootPathName[3] = (wchar_t)'\0'; /* e.g. "A:/" */
GetVolumeInformationW(rootPathName, tmp1, (DWORD)MAX_PATH,
&volSerNo, &maxCompLen, &fileSysFlags,
tmp2, (DWORD)MAX_PATH);
/* Volumes in (V)FAT and (OS/2) HPFS format store file timestamps in
* local time!
*/
return !wcsncmp(_wcsupr(tmp2), L"FAT", 3) ||
!wcsncmp(tmp2, L"VFAT", 4) ||
!wcsncmp(tmp2, L"HPFS", 4);
} /* end function FSusesLocalTimeW() */
开发者ID:AltroCoin,项目名称:altrocoin,代码行数:35,代码来源:win32_boinc.c
示例20: getFullyQualifiedPathName
static std::string getFullyQualifiedPathName(const std::string& filename)
{
const DWORD bufferSize = 0x200;
wchar_t buffer[bufferSize];
GetFullPathNameW(toWideString(filename).c_str(), bufferSize, buffer, nullptr);
return toUtf8(buffer);
}
开发者ID:cooky451,项目名称:passchain,代码行数:7,代码来源:main.cpp
注:本文中的GetFullPathNameW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论