From: Alex Henrie alexhenrie24@gmail.com
--- dlls/schedsvc/atsvc.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c index e8ea1b25c6f..aa7881d39ba 100644 --- a/dlls/schedsvc/atsvc.c +++ b/dlls/schedsvc/atsvc.c @@ -354,15 +354,15 @@ static DWORD load_unicode_strings(const char *data, DWORD limit, struct job_t *j switch (i) { case 0: - job->info.Command = heap_strdupW((const WCHAR *)data); + job->info.Command = wcsdup((const WCHAR *)data); break;
case 1: - job->params = heap_strdupW((const WCHAR *)data); + job->params = wcsdup((const WCHAR *)data); break;
case 2: - job->curdir = heap_strdupW((const WCHAR *)data); + job->curdir = wcsdup((const WCHAR *)data); break;
default: @@ -504,7 +504,7 @@ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info) return FALSE; }
- info->trigger = heap_alloc(info->trigger_count * sizeof(info->trigger[0])); + info->trigger = malloc(info->trigger_count * sizeof(info->trigger[0])); if (!info->trigger) { TRACE("not enough memory for trigger data\n"); @@ -596,24 +596,24 @@ static BOOL load_job(const WCHAR *name, struct job_t *info)
static void free_job_info(AT_ENUM *info) { - heap_free(info->Command); + free(info->Command); }
static void free_job(struct job_t *job) { free_job_info(&job->info); - heap_free(job->name); - heap_free(job->params); - heap_free(job->curdir); - heap_free(job->trigger); - heap_free(job); + free(job->name); + free(job->params); + free(job->curdir); + free(job->trigger); + free(job); }
void add_job(const WCHAR *name) { struct job_t *job;
- job = heap_alloc_zero(sizeof(*job)); + job = calloc(1, sizeof(*job)); if (!job) return;
if (!load_job(name, job)) @@ -623,7 +623,7 @@ void add_job(const WCHAR *name) }
EnterCriticalSection(&at_job_list_section); - job->name = heap_strdupW(name); + job->name = wcsdup(name); job->info.JobId = current_jobid++; list_add_tail(&at_job_list, &job->entry); LeaveCriticalSection(&at_job_list_section); @@ -920,7 +920,7 @@ void update_process_status(DWORD pid) { CloseHandle(runjob->process); list_remove(&runjob->entry); - heap_free(runjob); + free(runjob);
job->data.exit_code = exit_code; job->data.status = SCHED_S_TASK_TERMINATED; @@ -969,7 +969,7 @@ void check_task_state(void) if (job->instance_count) FIXME("process %s is already running\n", debugstr_w(job->info.Command));
- runjob = heap_alloc(sizeof(*runjob)); + runjob = malloc(sizeof(*runjob)); if (runjob) { static WCHAR winsta0[] = { 'W','i','n','S','t','a','0',0 }; @@ -1179,9 +1179,9 @@ static void free_container(AT_ENUM_CONTAINER *container) DWORD i;
for (i = 0; i < container->EntriesRead; i++) - heap_free(container->Buffer[i].Command); + free(container->Buffer[i].Command);
- heap_free(container->Buffer); + free(container->Buffer); }
DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container, @@ -1197,7 +1197,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container container->EntriesRead = 0;
allocated = 64; - container->Buffer = heap_alloc(allocated * sizeof(AT_ENUM)); + container->Buffer = malloc(allocated * sizeof(AT_ENUM)); if (!container->Buffer) return ERROR_NOT_ENOUGH_MEMORY;
EnterCriticalSection(&at_job_list_section); @@ -1215,7 +1215,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container AT_ENUM *new_buffer;
allocated *= 2; - new_buffer = heap_realloc(container->Buffer, allocated * sizeof(AT_ENUM)); + new_buffer = realloc(container->Buffer, allocated * sizeof(AT_ENUM)); if (!new_buffer) { free_container(container); @@ -1226,7 +1226,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container }
container->Buffer[container->EntriesRead] = job->info; - container->Buffer[container->EntriesRead].Command = heap_strdupW(job->info.Command); + container->Buffer[container->EntriesRead].Command = wcsdup(job->info.Command); container->EntriesRead++; }
@@ -1249,7 +1249,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in job = find_job(jobid, NULL, NULL); if (job) { - AT_INFO *info_ret = heap_alloc(sizeof(*info_ret)); + AT_INFO *info_ret = malloc(sizeof(*info_ret)); if (!info_ret) ret = ERROR_NOT_ENOUGH_MEMORY; else @@ -1258,7 +1258,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in info_ret->DaysOfMonth = job->info.DaysOfMonth; info_ret->DaysOfWeek = job->info.DaysOfWeek; info_ret->Flags = job->info.Flags; - info_ret->Command = heap_strdupW(job->info.Command); + info_ret->Command = wcsdup(job->info.Command); *info = info_ret; ret = ERROR_SUCCESS; }
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/schedsvc/schedsvc.c | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/dlls/schedsvc/schedsvc.c b/dlls/schedsvc/schedsvc.c index ba6da110fe5..c670c8b1cbb 100644 --- a/dlls/schedsvc/schedsvc.c +++ b/dlls/schedsvc/schedsvc.c @@ -58,7 +58,7 @@ static WCHAR *get_full_name(const WCHAR *path, WCHAR **relative_path) len = GetSystemDirectoryW(NULL, 0); len += lstrlenW(tasksW) + lstrlenW(path);
- target = heap_alloc(len * sizeof(WCHAR)); + target = malloc(len * sizeof(WCHAR)); if (target) { GetSystemDirectoryW(target, len); @@ -80,7 +80,7 @@ static HRESULT create_directory(const WCHAR *path) WCHAR *new_path; int len;
- new_path = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR)); + new_path = malloc((lstrlenW(path) + 1) * sizeof(WCHAR)); if (!new_path) return E_OUTOFMEMORY;
lstrcpyW(new_path, path); @@ -110,7 +110,7 @@ static HRESULT create_directory(const WCHAR *path) new_path[len] = '\'; }
- heap_free(new_path); + free(new_path); return hr; }
@@ -132,7 +132,7 @@ static HRESULT write_xml_utf8(const WCHAR *name, DWORD disposition, const WCHAR }
size = WideCharToMultiByte(CP_UTF8, 0, xmlW, -1, NULL, 0, NULL, NULL); - xml = heap_alloc(size); + xml = malloc(size); if (!xml) { CloseHandle(hfile); @@ -167,7 +167,7 @@ static HRESULT write_xml_utf8(const WCHAR *name, DWORD disposition, const WCHAR }
failed: - heap_free(xml); + free(xml); CloseHandle(hfile); return hr; } @@ -202,7 +202,7 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl hr = create_directory(full_name); if (hr != S_OK && hr != HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) { - heap_free(full_name); + free(full_name); return hr; } *p = '\'; @@ -241,11 +241,11 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl hr = write_xml_utf8(full_name, disposition, xml); if (hr == S_OK) { - *actual_path = heap_strdupW(relative_path); + *actual_path = wcsdup(relative_path); schedsvc_auto_start(); }
- heap_free(full_name); + free(full_name); return hr; }
@@ -286,7 +286,7 @@ static HRESULT read_xml(const WCHAR *name, WCHAR **xml) return HRESULT_FROM_WIN32(GetLastError());
size = GetFileSize(hfile, NULL); - buff = src = heap_alloc(size + 2); + buff = src = malloc(size + 2); if (!src) { CloseHandle(hfile); @@ -310,12 +310,12 @@ static HRESULT read_xml(const WCHAR *name, WCHAR **xml) src += sizeof(bom_utf8);
size = MultiByteToWideChar(cp, 0, src, -1, NULL, 0); - *xml = heap_alloc(size * sizeof(WCHAR)); + *xml = malloc(size * sizeof(WCHAR)); if (*xml) MultiByteToWideChar(cp, 0, src, -1, *xml, size); else hr = E_OUTOFMEMORY; - heap_free(buff); + free(buff);
return hr; } @@ -539,7 +539,7 @@ HRESULT __cdecl SchRpcRetrieveTask(const WCHAR *path, const WCHAR *languages, UL hr = read_xml(full_name, xml); if (hr != S_OK) *xml = NULL;
- heap_free(full_name); + free(full_name); return hr; }
@@ -557,7 +557,7 @@ HRESULT __cdecl SchRpcCreateFolder(const WCHAR *path, const WCHAR *sddl, DWORD f
hr = create_directory(full_name);
- heap_free(full_name); + free(full_name); return hr; }
@@ -578,9 +578,9 @@ static void free_list(TASK_NAMES list, LONG count) LONG i;
for (i = 0; i < count; i++) - heap_free(list[i]); + free(list[i]);
- heap_free(list); + free(list); }
static inline BOOL is_directory(const WIN32_FIND_DATAW *data) @@ -628,17 +628,17 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i
if (lstrlenW(full_name) + 2 > MAX_PATH) { - heap_free(full_name); + free(full_name); return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); }
lstrcpyW(pathW, full_name); lstrcatW(pathW, allW);
- heap_free(full_name); + free(full_name);
allocated = 64; - list = heap_alloc(allocated * sizeof(list[0])); + list = malloc(allocated * sizeof(list[0])); if (!list) return E_OUTOFMEMORY;
index = count = 0; @@ -646,7 +646,7 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i handle = FindFirstFileW(pathW, &data); if (handle == INVALID_HANDLE_VALUE) { - heap_free(list); + free(list); if (GetLastError() == ERROR_PATH_NOT_FOUND) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); return HRESULT_FROM_WIN32(GetLastError()); @@ -671,7 +671,7 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i
TRACE("adding %s\n", debugstr_w(data.cFileName));
- list[count] = heap_strdupW(data.cFileName); + list[count] = wcsdup(data.cFileName); if (!list[count]) { hr = E_OUTOFMEMORY; @@ -705,7 +705,7 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i return hr; }
- heap_free(list); + free(list); *names = NULL; return *start_index ? S_FALSE : S_OK; } @@ -736,17 +736,17 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind
if (lstrlenW(full_name) + 2 > MAX_PATH) { - heap_free(full_name); + free(full_name); return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); }
lstrcpyW(pathW, full_name); lstrcatW(pathW, allW);
- heap_free(full_name); + free(full_name);
allocated = 64; - list = heap_alloc(allocated * sizeof(list[0])); + list = malloc(allocated * sizeof(list[0])); if (!list) return E_OUTOFMEMORY;
index = count = 0; @@ -754,7 +754,7 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind handle = FindFirstFileW(pathW, &data); if (handle == INVALID_HANDLE_VALUE) { - heap_free(list); + free(list); if (GetLastError() == ERROR_PATH_NOT_FOUND) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); return HRESULT_FROM_WIN32(GetLastError()); @@ -779,7 +779,7 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind
TRACE("adding %s\n", debugstr_w(data.cFileName));
- list[count] = heap_strdupW(data.cFileName); + list[count] = wcsdup(data.cFileName); if (!list[count]) { hr = E_OUTOFMEMORY; @@ -813,7 +813,7 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind return hr; }
- heap_free(list); + free(list); *names = NULL; return *start_index ? S_FALSE : S_OK; } @@ -874,7 +874,7 @@ HRESULT __cdecl SchRpcDelete(const WCHAR *path, DWORD flags) hr = DeleteFileW(full_name) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); }
- heap_free(full_name); + free(full_name); return hr; }
@@ -910,10 +910,10 @@ HRESULT __cdecl SchRpcGetTaskInfo(const WCHAR *path, DWORD flags, DWORD *enabled if (!full_name) return E_OUTOFMEMORY;
hr = read_xml(full_name, &xml); - heap_free(full_name); + free(full_name); if (hr != S_OK) return hr; hr = read_task_info_from_xml(xml, &info); - heap_free(xml); + free(xml); if (FAILED(hr)) return hr;
*enabled = info.enabled;
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/schedsvc/schedsvc_private.h | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/dlls/schedsvc/schedsvc_private.h b/dlls/schedsvc/schedsvc_private.h index 1eada2bca96..62b25f97794 100644 --- a/dlls/schedsvc/schedsvc_private.h +++ b/dlls/schedsvc/schedsvc_private.h @@ -32,14 +32,4 @@ void check_task_time(void) DECLSPEC_HIDDEN; void load_at_tasks(void) DECLSPEC_HIDDEN; void check_missed_task_time(void) DECLSPEC_HIDDEN;
-static inline WCHAR *heap_strdupW(const WCHAR *src) -{ - WCHAR *dst; - unsigned len; - if (!src) return NULL; - len = (lstrlenW(src) + 1) * sizeof(WCHAR); - if ((dst = heap_alloc(len))) memcpy(dst, src, len); - return dst; -} - #endif /* __WINE_SCHEDSVC_PRIVATE_H__ */