本文整理汇总了C++中ILFree函数的典型用法代码示例。如果您正苦于以下问题:C++ ILFree函数的具体用法?C++ ILFree怎么用?C++ ILFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ILFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SHELL32_ParseNextElement
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc,
LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes)
{
LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL;
IShellFolder *psfChild;
HRESULT hr;
TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlInOut ? *pidlInOut : NULL, debugstr_w (szNext));
/* get the shellfolder for the child pidl and let it analyse further */
hr = IShellFolder2_BindToObject (psf, *pidlInOut, pbc, &IID_IShellFolder, (LPVOID *) & psfChild);
if (SUCCEEDED(hr)) {
hr = IShellFolder_ParseDisplayName (psfChild, hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
IShellFolder_Release (psfChild);
if (SUCCEEDED(hr)) {
pidlTemp = ILCombine (*pidlInOut, pidlOut);
if (!pidlTemp)
hr = E_OUTOFMEMORY;
}
if (pidlOut)
ILFree (pidlOut);
}
ILFree (*pidlInOut);
*pidlInOut = pidlTemp;
TRACE ("-- pidl=%p ret=0x%08x\n", pidlInOut ? *pidlInOut : NULL, hr);
return hr;
}
示例2: Task_Mkdir
/*
* Make a directory.
*/
static int Task_Mkdir(CSAntTask *task)
{
const char *dirParam = CSAntTaskParam(task, "dir");
char *dir;
int retval;
if(!dirParam)
{
fprintf(stderr, "no directory to make in <mkdir>\n");
return 0;
}
dir = CSAntDirCombine(CSAntBaseBuildDir, dirParam);
if(!CSAntSilent)
{
printf("mkdir -p %s\n", dir);
}
retval = Mkdir_P(CSAntBaseBuildDir, dirParam);
if(retval != IL_ERRNO_Success)
{
ILSysIOSetErrno(retval);
perror(dir);
ILFree(dir);
return 0;
}
ILFree(dir);
return 1;
}
示例3: ILFree
ILDir *ILOpenDir(const char *path)
{
char *spec;
int len;
ILDir *dir = (ILDir *)ILMalloc(sizeof(ILDir));
if(!dir)
{
return 0;
}
spec = (char *)ILMalloc(strlen(path) + 5);
if(!spec)
{
ILFree(dir);
return 0;
}
strcpy(spec, path);
len = strlen(spec);
if(len > 0 && spec[len - 1] != '/' && spec[len - 1] != '\\')
{
spec[len++] = '\\';
}
strcpy(spec + len, "*.*");
dir->handle = _findfirst(spec, &(dir->fileinfo));
dir->havefirst = 1;
if(dir->handle < 0)
{
int error = errno;
ILFree(dir);
ILFree(spec);
errno = error;
return 0;
}
ILFree(spec);
return dir;
}
示例4: GetSymbol
void *ILDynLibraryGetSymbol(void *handle, const char *symbol)
{
void *value = GetSymbol(handle, (char *)symbol);
char *newName;
if(value)
{
return value;
}
newName = (char *)ILMalloc(strlen(symbol) + 2);
if(newName)
{
/* Try again with '_' prepended to the name */
newName[0] = '_';
strcpy(newName + 1, symbol);
value = GetSymbol(handle, newName);
if(value)
{
ILFree(newName);
return value;
}
ILFree(newName);
}
#ifdef IL_DYNLIB_DEBUG
fprintf(stderr, "%s: could not find the specified symbol\n", symbol);
#endif
return 0;
}
示例5: dlsym
void *ILDynLibraryGetSymbol(void *handle, const char *symbol)
{
void *value = dlsym(handle, (char *)symbol);
const char *error = dlerror();
char *newName;
if(error == 0)
{
return value;
}
newName = (char *)ILMalloc(strlen(symbol) + 2);
if(newName)
{
/* Try again with '_' prepended to the name in case
we are running on a system with a busted "dlsym" */
newName[0] = '_';
strcpy(newName + 1, symbol);
value = dlsym(handle, newName);
error = dlerror();
if(error == 0)
{
ILFree(newName);
return value;
}
ILFree(newName);
}
#ifdef IL_DYNLIB_DEBUG
fprintf(stderr, "%s: %s\n", symbol, error);
#endif
return 0;
}
示例6: ILDupString
/*
* Implementing this way because opendir seems to be somewhat non-standardised.
* so basically I think this way will be a lot more portable.
*/
ILDir *ILOpenDir(const char *path)
{
#ifdef HAVE_DIRENT_H
ILDir *dir = (ILDir *)ILMalloc(sizeof(ILDir));
if(dir)
{
dir->pathname = ILDupString(path);
if(!(dir->pathname))
{
ILFree(dir);
return (ILDir *)0;
}
dir->dir = opendir(dir->pathname);
if(!(dir->dir))
{
ILFree(dir->pathname);
ILFree(dir);
return (ILDir *)0;
}
}
return dir;
#else
errno = ENOENT;
return (ILDir *)0;
#endif
}
示例7: ILNode_CName_83__
static CName ILNode_CName_83__(ILNode_Conditional *node)
#line 505 "c_name.tc"
{
CName name1 = ILNode_CName(node->expr1);
CName name2 = ILNode_CName(node->expr2);
CName name3 = ILNode_CName(node->expr3);
CName result;
result.name = (char *)ILMalloc(strlen(name1.name) + strlen(name2.name) +
strlen(name3.name) + 15);
if(!(result.name))
{
CCOutOfMemory();
}
strcpy(result.name, "((");
strcat(result.name, name1.name);
strcat(result.name, ") ? (");
strcat(result.name, name2.name);
strcat(result.name, ") : (");
strcat(result.name, name3.name);
strcat(result.name, "))");
ILFree(name1.name);
ILFree(name2.name);
ILFree(name3.name);
result.prec = C_PREC_PRIMARY;
return result;
}
示例8: ILArrayListDestroy
static void ILArrayListDestroy(ILList *_list)
{
ILArrayList *list = (ILArrayList *)_list;
ILFree(list->array);
ILFree(list);
}
示例9: ILSerializeWriterDestroy
void ILSerializeWriterDestroy(ILSerializeWriter *writer)
{
if(writer->blob)
{
ILFree(writer->blob);
}
ILFree(writer);
}
示例10: test_parse_for_entire_network
/* Tests for My Network Places */
static void test_parse_for_entire_network(void)
{
static WCHAR my_network_places_path[] = {
':',':','{','2','0','8','D','2','C','6','0','-','3','A','E','A','-',
'1','0','6','9','-','A','2','D','7','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 };
static WCHAR entire_network_path[] = {
':',':','{','2','0','8','D','2','C','6','0','-','3','A','E','A','-',
'1','0','6','9','-','A','2','D','7','-','0','8','0','0','2','B','3','0','3','0','9','D',
'}','\\','E','n','t','i','r','e','N','e','t','w','o','r','k',0 };
IShellFolder *psfDesktop;
HRESULT hr;
DWORD eaten = 0xdeadbeef;
LPITEMIDLIST pidl;
DWORD attr = ~0;
DWORD expected_attr;
hr = SHGetDesktopFolder(&psfDesktop);
ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%x\n", hr);
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, my_network_places_path, &eaten, &pidl, &attr);
ok(hr == S_OK, "IShellFolder_ParseDisplayName failed with error 0x%x\n", hr);
todo_wine
ok(eaten == 0xdeadbeef, "eaten should not have been set to %u\n", eaten);
expected_attr = SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
todo_wine
ok((attr == expected_attr) || /* Win9x, NT4 */
(attr == (expected_attr | SFGAO_STREAM)) || /* W2K */
(attr == (expected_attr | SFGAO_CANDELETE)) || /* XP, W2K3 */
(attr == (expected_attr | SFGAO_CANDELETE | SFGAO_NONENUMERATED)), /* Vista */
"Unexpected attributes : %08x\n", attr);
ILFree(pidl);
/* Start clean again */
eaten = 0xdeadbeef;
attr = ~0;
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, entire_network_path, &eaten, &pidl, &attr);
IShellFolder_Release(psfDesktop);
if (hr == HRESULT_FROM_WIN32(ERROR_BAD_NET_NAME) ||
hr == HRESULT_FROM_WIN32(ERROR_NO_NET_OR_BAD_PATH) ||
hr == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER))
{
win_skip("'EntireNetwork' is not available on Win9x, NT4 and Vista\n");
return;
}
ok(hr == S_OK, "IShellFolder_ParseDisplayName failed with error 0x%x\n", hr);
todo_wine
ok(eaten == 0xdeadbeef, "eaten should not have been set to %u\n", eaten);
expected_attr = SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
todo_wine
ok(attr == expected_attr || /* winme, nt4 */
attr == (expected_attr | SFGAO_STREAM) || /* win2k */
attr == (expected_attr | SFGAO_STORAGEANCESTOR), /* others */
"attr should be 0x%x, not 0x%x\n", expected_attr, attr);
ILFree(pidl);
}
示例11: defined
/* This function will return NULL on error */
ILDirEnt *ILReadDir(ILDir *directory)
{
#ifdef HAVE_DIRENT_H
#if defined(HAVE_READDIR_R) && !defined(BROKEN_DIRENT)
ILDirEnt *result = NULL;
/* Threadsafe version of readdir() */
/* Fetch a directory entry */
if((result = (ILDirEnt *)ILMalloc(sizeof(ILDirEnt))) == NULL)
{
return NULL;
}
if(readdir_r(directory->dir, &(result->de), &(result->dptr)) != 0)
{
ILFree(result);
return NULL;
}
if(!(result->dptr)) /* yet another terminating condition */
{
ILFree(result);
return NULL;
}
GetDirEntryType(directory, result);
return result;
#else
#ifdef HAVE_READDIR
/* Not Threadsafe, so maybe if systems need it, we should rewrite it. */
struct dirent *result;
ILDirEnt *allocatedResult = NULL;
if((result = readdir(directory->dir)) == NULL)
{
return NULL;
}
/* After we know we HAVE a result, we copy it's contents into our
* own struct */
allocatedResult = (ILDirEnt *)ILMalloc(sizeof(ILDirEnt));
if(allocatedResult != NULL)
{
allocatedResult->dptr = &(allocatedResult->de);
ILMemCpy(&(allocatedResult->de), result, sizeof(struct dirent));
#if defined(BROKEN_DIRENT)
strcpy(allocatedResult->de.d_name, result->d_name);
#endif
GetDirEntryType(directory, allocatedResult);
}
return allocatedResult;
#else
return NULL;
#endif
#endif
#else
return NULL;
#endif
}
示例12: SHCreateShellItem
HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
IShellFolder *psfParent, LPCITEMIDLIST pidl, IShellItem **ppsi)
{
LPITEMIDLIST new_pidl;
HRESULT ret;
TRACE("(%p,%p,%p,%p)\n", pidlParent, psfParent, pidl, ppsi);
*ppsi = NULL;
if (!pidl)
{
return E_INVALIDARG;
}
else if (pidlParent || psfParent)
{
LPITEMIDLIST temp_parent=NULL;
if (!pidlParent)
{
IPersistFolder2* ppf2Parent;
if (FAILED(IShellFolder_QueryInterface(psfParent, &IID_IPersistFolder2, (void**)&ppf2Parent)))
{
FIXME("couldn't get IPersistFolder2 interface of parent\n");
return E_NOINTERFACE;
}
if (FAILED(IPersistFolder2_GetCurFolder(ppf2Parent, &temp_parent)))
{
FIXME("couldn't get parent PIDL\n");
IPersistFolder2_Release(ppf2Parent);
return E_NOINTERFACE;
}
pidlParent = temp_parent;
IPersistFolder2_Release(ppf2Parent);
}
new_pidl = ILCombine(pidlParent, pidl);
ILFree(temp_parent);
if (!new_pidl)
return E_OUTOFMEMORY;
}
else
{
new_pidl = ILClone(pidl);
if (!new_pidl)
return E_OUTOFMEMORY;
}
ret = SHCreateItemFromIDList(new_pidl, &IID_IShellItem, (void**)ppsi);
ILFree(new_pidl);
return ret;
}
示例13: DestroyParameter
/*
* Destroy a parameter.
*/
static void DestroyParameter(ILDocParameter *parameter)
{
if(parameter->name)
{
ILFree(parameter->name);
}
if(parameter->type)
{
ILFree(parameter->type);
}
}
示例14: ILCloseDir
int ILCloseDir(ILDir *directory)
{
#ifdef HAVE_DIRENT_H
int result = (closedir(directory->dir) == 0);
ILFree(directory->pathname);
ILFree(directory);
return result;
#else
return 0;
#endif
}
示例15: CreateLnkOnDesktop
void CreateLnkOnDesktop(const LPWSTR connTitle)
{
IShellLink *SLink;
IPersistFile *PF;
HRESULT HRes;
TCHAR desktop_path[MAX_PATH] = TEXT("");
TCHAR pszFullLnkPath[MAX_PATH];
CoInitialize(NULL);
ITEMIDLIST* pidl1 = NULL;
SHGetFolderLocation(NULL, CSIDL_CONNECTIONS, NULL, 0, &pidl1);
IShellFolder *desktop, *ncfolder;
SHGetDesktopFolder(&desktop);
desktop->BindToObject(pidl1, NULL, IID_IShellFolder, (void**)&ncfolder);
IEnumIDList *items;
ncfolder->EnumObjects(NULL, SHCONTF_NONFOLDERS, &items);
ITEMIDLIST* pidl2 = NULL;
while (S_OK == items->Next(1, &pidl2, NULL))
{
STRRET sr = {STRRET_WSTR};
ncfolder->GetDisplayNameOf(pidl2, SHGDN_NORMAL, &sr);
TCHAR buf[MAX_PATH] = TEXT("");
StrRetToBuf(&sr, pidl2, buf, MAX_PATH);
if (0 == StrCmpI(buf, connTitle))
{
ITEMIDLIST* pidl3 = ILCombine(pidl1, pidl2);
HRESULT HRes = CoCreateInstance(CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, IID_IShellLink, ( LPVOID*)&SLink);
SLink->SetIDList(pidl3);
SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktop_path);
StringCbPrintf(pszFullLnkPath, MAX_PATH * sizeof(TCHAR), TEXT("%s\\%s.lnk"), desktop_path, connTitle);
HRes = SLink->QueryInterface(IID_IPersistFile, (LPVOID*)&PF);
HRes = PF->Save((LPCOLESTR)pszFullLnkPath, TRUE);
PF->Release();
SLink->Release();
ILFree(pidl3);
ILFree(pidl2);
break;
}
ILFree(pidl2);
pidl2 = NULL;
}
ncfolder->Release();
desktop->Release();
ILFree(pidl1);
CoUninitialize();
}