Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
4ee48f26
Commit
4ee48f26
authored
Nov 17, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schedsvc: Use standard C functions for memory allocation in atsvc.c.
parent
caf39cd1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
atsvc.c
dlls/schedsvc/atsvc.c
+21
-21
No files found.
dlls/schedsvc/atsvc.c
View file @
4ee48f26
...
@@ -354,15 +354,15 @@ static DWORD load_unicode_strings(const char *data, DWORD limit, struct job_t *j
...
@@ -354,15 +354,15 @@ static DWORD load_unicode_strings(const char *data, DWORD limit, struct job_t *j
switch
(
i
)
switch
(
i
)
{
{
case
0
:
case
0
:
job
->
info
.
Command
=
heap_strdupW
((
const
WCHAR
*
)
data
);
job
->
info
.
Command
=
wcsdup
((
const
WCHAR
*
)
data
);
break
;
break
;
case
1
:
case
1
:
job
->
params
=
heap_strdupW
((
const
WCHAR
*
)
data
);
job
->
params
=
wcsdup
((
const
WCHAR
*
)
data
);
break
;
break
;
case
2
:
case
2
:
job
->
curdir
=
heap_strdupW
((
const
WCHAR
*
)
data
);
job
->
curdir
=
wcsdup
((
const
WCHAR
*
)
data
);
break
;
break
;
default:
default:
...
@@ -504,7 +504,7 @@ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info)
...
@@ -504,7 +504,7 @@ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info)
return
FALSE
;
return
FALSE
;
}
}
info
->
trigger
=
heap_
alloc
(
info
->
trigger_count
*
sizeof
(
info
->
trigger
[
0
]));
info
->
trigger
=
m
alloc
(
info
->
trigger_count
*
sizeof
(
info
->
trigger
[
0
]));
if
(
!
info
->
trigger
)
if
(
!
info
->
trigger
)
{
{
TRACE
(
"not enough memory for trigger data
\n
"
);
TRACE
(
"not enough memory for trigger data
\n
"
);
...
@@ -596,24 +596,24 @@ static BOOL load_job(const WCHAR *name, struct job_t *info)
...
@@ -596,24 +596,24 @@ static BOOL load_job(const WCHAR *name, struct job_t *info)
static
void
free_job_info
(
AT_ENUM
*
info
)
static
void
free_job_info
(
AT_ENUM
*
info
)
{
{
heap_
free
(
info
->
Command
);
free
(
info
->
Command
);
}
}
static
void
free_job
(
struct
job_t
*
job
)
static
void
free_job
(
struct
job_t
*
job
)
{
{
free_job_info
(
&
job
->
info
);
free_job_info
(
&
job
->
info
);
heap_
free
(
job
->
name
);
free
(
job
->
name
);
heap_
free
(
job
->
params
);
free
(
job
->
params
);
heap_
free
(
job
->
curdir
);
free
(
job
->
curdir
);
heap_
free
(
job
->
trigger
);
free
(
job
->
trigger
);
heap_
free
(
job
);
free
(
job
);
}
}
void
add_job
(
const
WCHAR
*
name
)
void
add_job
(
const
WCHAR
*
name
)
{
{
struct
job_t
*
job
;
struct
job_t
*
job
;
job
=
heap_alloc_zero
(
sizeof
(
*
job
));
job
=
calloc
(
1
,
sizeof
(
*
job
));
if
(
!
job
)
return
;
if
(
!
job
)
return
;
if
(
!
load_job
(
name
,
job
))
if
(
!
load_job
(
name
,
job
))
...
@@ -623,7 +623,7 @@ void add_job(const WCHAR *name)
...
@@ -623,7 +623,7 @@ void add_job(const WCHAR *name)
}
}
EnterCriticalSection
(
&
at_job_list_section
);
EnterCriticalSection
(
&
at_job_list_section
);
job
->
name
=
heap_strdupW
(
name
);
job
->
name
=
wcsdup
(
name
);
job
->
info
.
JobId
=
current_jobid
++
;
job
->
info
.
JobId
=
current_jobid
++
;
list_add_tail
(
&
at_job_list
,
&
job
->
entry
);
list_add_tail
(
&
at_job_list
,
&
job
->
entry
);
LeaveCriticalSection
(
&
at_job_list_section
);
LeaveCriticalSection
(
&
at_job_list_section
);
...
@@ -920,7 +920,7 @@ void update_process_status(DWORD pid)
...
@@ -920,7 +920,7 @@ void update_process_status(DWORD pid)
{
{
CloseHandle
(
runjob
->
process
);
CloseHandle
(
runjob
->
process
);
list_remove
(
&
runjob
->
entry
);
list_remove
(
&
runjob
->
entry
);
heap_
free
(
runjob
);
free
(
runjob
);
job
->
data
.
exit_code
=
exit_code
;
job
->
data
.
exit_code
=
exit_code
;
job
->
data
.
status
=
SCHED_S_TASK_TERMINATED
;
job
->
data
.
status
=
SCHED_S_TASK_TERMINATED
;
...
@@ -969,7 +969,7 @@ void check_task_state(void)
...
@@ -969,7 +969,7 @@ void check_task_state(void)
if
(
job
->
instance_count
)
if
(
job
->
instance_count
)
FIXME
(
"process %s is already running
\n
"
,
debugstr_w
(
job
->
info
.
Command
));
FIXME
(
"process %s is already running
\n
"
,
debugstr_w
(
job
->
info
.
Command
));
runjob
=
heap_
alloc
(
sizeof
(
*
runjob
));
runjob
=
m
alloc
(
sizeof
(
*
runjob
));
if
(
runjob
)
if
(
runjob
)
{
{
static
WCHAR
winsta0
[]
=
{
'W'
,
'i'
,
'n'
,
'S'
,
't'
,
'a'
,
'0'
,
0
};
static
WCHAR
winsta0
[]
=
{
'W'
,
'i'
,
'n'
,
'S'
,
't'
,
'a'
,
'0'
,
0
};
...
@@ -1179,9 +1179,9 @@ static void free_container(AT_ENUM_CONTAINER *container)
...
@@ -1179,9 +1179,9 @@ static void free_container(AT_ENUM_CONTAINER *container)
DWORD
i
;
DWORD
i
;
for
(
i
=
0
;
i
<
container
->
EntriesRead
;
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
,
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
...
@@ -1197,7 +1197,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container
container
->
EntriesRead
=
0
;
container
->
EntriesRead
=
0
;
allocated
=
64
;
allocated
=
64
;
container
->
Buffer
=
heap_
alloc
(
allocated
*
sizeof
(
AT_ENUM
));
container
->
Buffer
=
m
alloc
(
allocated
*
sizeof
(
AT_ENUM
));
if
(
!
container
->
Buffer
)
return
ERROR_NOT_ENOUGH_MEMORY
;
if
(
!
container
->
Buffer
)
return
ERROR_NOT_ENOUGH_MEMORY
;
EnterCriticalSection
(
&
at_job_list_section
);
EnterCriticalSection
(
&
at_job_list_section
);
...
@@ -1215,7 +1215,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container
...
@@ -1215,7 +1215,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container
AT_ENUM
*
new_buffer
;
AT_ENUM
*
new_buffer
;
allocated
*=
2
;
allocated
*=
2
;
new_buffer
=
heap_
realloc
(
container
->
Buffer
,
allocated
*
sizeof
(
AT_ENUM
));
new_buffer
=
realloc
(
container
->
Buffer
,
allocated
*
sizeof
(
AT_ENUM
));
if
(
!
new_buffer
)
if
(
!
new_buffer
)
{
{
free_container
(
container
);
free_container
(
container
);
...
@@ -1226,7 +1226,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_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
]
=
job
->
info
;
container
->
Buffer
[
container
->
EntriesRead
].
Command
=
heap_strdupW
(
job
->
info
.
Command
);
container
->
Buffer
[
container
->
EntriesRead
].
Command
=
wcsdup
(
job
->
info
.
Command
);
container
->
EntriesRead
++
;
container
->
EntriesRead
++
;
}
}
...
@@ -1249,7 +1249,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in
...
@@ -1249,7 +1249,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in
job
=
find_job
(
jobid
,
NULL
,
NULL
);
job
=
find_job
(
jobid
,
NULL
,
NULL
);
if
(
job
)
if
(
job
)
{
{
AT_INFO
*
info_ret
=
heap_
alloc
(
sizeof
(
*
info_ret
));
AT_INFO
*
info_ret
=
m
alloc
(
sizeof
(
*
info_ret
));
if
(
!
info_ret
)
if
(
!
info_ret
)
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
else
else
...
@@ -1258,7 +1258,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in
...
@@ -1258,7 +1258,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in
info_ret
->
DaysOfMonth
=
job
->
info
.
DaysOfMonth
;
info_ret
->
DaysOfMonth
=
job
->
info
.
DaysOfMonth
;
info_ret
->
DaysOfWeek
=
job
->
info
.
DaysOfWeek
;
info_ret
->
DaysOfWeek
=
job
->
info
.
DaysOfWeek
;
info_ret
->
Flags
=
job
->
info
.
Flags
;
info_ret
->
Flags
=
job
->
info
.
Flags
;
info_ret
->
Command
=
heap_strdupW
(
job
->
info
.
Command
);
info_ret
->
Command
=
wcsdup
(
job
->
info
.
Command
);
*
info
=
info_ret
;
*
info
=
info_ret
;
ret
=
ERROR_SUCCESS
;
ret
=
ERROR_SUCCESS
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment