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
6374cd23
Commit
6374cd23
authored
Aug 15, 1999
by
Thuy Nguyen
Committed by
Alexandre Julliard
Aug 15, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced a static ten element array with a dynamic pointer array.
parent
40320f3e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
29 deletions
+117
-29
Makefile.in
dlls/winspool/Makefile.in
+2
-1
info.c
dlls/winspool/info.c
+67
-28
winspool.spec
dlls/winspool/winspool.spec
+1
-0
wspool.c
dlls/winspool/wspool.c
+47
-0
No files found.
dlls/winspool/Makefile.in
View file @
6374cd23
...
...
@@ -8,7 +8,8 @@ MODULE = winspool
SPEC_SRCS
=
winspool.spec
C_SRCS
=
\
info.c
info.c
\
wspool.c
all
:
$(MODULE).o
...
...
dlls/winspool/info.c
View file @
6374cd23
...
...
@@ -15,13 +15,12 @@
#include "winreg.h"
#include "debugtools.h"
#include "heap.h"
#include "commctrl.h"
DEFAULT_DEBUG_CHANNEL
(
winspool
)
CRITICAL_SECTION
PRINT32_RegistryBlocker
;
#define NUM_PRINTER_MAX 10
typedef
struct
_OPENEDPRINTERA
{
LPSTR
lpsPrinterName
;
...
...
@@ -29,28 +28,18 @@ typedef struct _OPENEDPRINTERA
LPPRINTER_DEFAULTSA
lpDefault
;
}
OPENEDPRINTERA
,
*
LPOPENEDPRINTERA
;
/* The OpenedPrinter Table dynamic array */
static
HDPA
pOpenedPrinterDPA
=
NULL
;
/* Initialize the structure OpenedPrinter Table */
static
OPENEDPRINTERA
OpenedPrinterTableA
[
NUM_PRINTER_MAX
]
=
{
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
},
{
NULL
,
-
1
,
NULL
}
};
extern
HDPA
(
WINAPI
*
WINSPOOL_DPA_CreateEx
)
(
INT
,
HANDLE
);
extern
LPVOID
(
WINAPI
*
WINSPOOL_DPA_GetPtr
)
(
const
HDPA
,
INT
);
extern
INT
(
WINAPI
*
WINSPOOL_DPA_InsertPtr
)
(
const
HDPA
,
INT
,
LPVOID
);
static
char
Printers
[]
=
"System
\\
CurrentControlSet
\\
control
\\
Print
\\
Printers
\\
"
;
static
char
Drivers
[]
=
"System
\\
CurrentControlSet
\\
control
\\
Print
\\
Environments
\\
Wine
\\
Drivers
\\
"
;
/******************************************************************
* WINSPOOL_GetOpenedPrinterEntryA
* Get the first place empty in the opened printer table
...
...
@@ -58,12 +47,51 @@ static char Drivers[] =
static
LPOPENEDPRINTERA
WINSPOOL_GetOpenedPrinterEntryA
()
{
int
i
;
for
(
i
=
0
;
i
<
NUM_PRINTER_MAX
;
i
++
)
if
(
OpenedPrinterTableA
[
i
].
hPrinter
==
-
1
)
{
OpenedPrinterTableA
[
i
].
hPrinter
=
i
+
1
;
return
&
OpenedPrinterTableA
[
i
];
}
LPOPENEDPRINTERA
pOpenedPrinter
;
/*
* Create the opened printers' handle dynamic array.
*/
if
(
!
pOpenedPrinterDPA
)
{
pOpenedPrinterDPA
=
WINSPOOL_DPA_CreateEx
(
10
,
GetProcessHeap
());
for
(
i
=
0
;
i
<
10
;
i
++
)
{
pOpenedPrinter
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
OPENEDPRINTERA
));
pOpenedPrinter
->
hPrinter
=
-
1
;
WINSPOOL_DPA_InsertPtr
(
pOpenedPrinterDPA
,
i
,
pOpenedPrinter
);
}
}
/*
* Search for a handle not yet allocated.
*/
for
(
i
=
0
;
i
<
pOpenedPrinterDPA
->
nItemCount
;
i
++
)
{
pOpenedPrinter
=
WINSPOOL_DPA_GetPtr
(
pOpenedPrinterDPA
,
i
);
if
(
pOpenedPrinter
->
hPrinter
==
-
1
)
{
pOpenedPrinter
->
hPrinter
=
i
+
1
;
return
pOpenedPrinter
;
}
}
/*
* Didn't find one, insert new element in the array.
*/
if
(
i
==
pOpenedPrinterDPA
->
nItemCount
)
{
pOpenedPrinter
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
OPENEDPRINTERA
));
pOpenedPrinter
->
hPrinter
=
i
+
1
;
WINSPOOL_DPA_InsertPtr
(
pOpenedPrinterDPA
,
i
,
pOpenedPrinter
);
return
pOpenedPrinter
;
}
return
NULL
;
}
...
...
@@ -73,9 +101,15 @@ static LPOPENEDPRINTERA WINSPOOL_GetOpenedPrinterEntryA()
*/
static
LPOPENEDPRINTERA
WINSPOOL_GetOpenedPrinterA
(
int
printerHandle
)
{
if
((
printerHandle
<=
0
)
||
(
printerHandle
>
(
NUM_PRINTER_MAX
+
1
)))
return
NULL
;
return
&
OpenedPrinterTableA
[
printerHandle
-
1
];
LPOPENEDPRINTERA
pOpenedPrinter
;
if
((
printerHandle
<=
0
)
||
(
printerHandle
>
(
pOpenedPrinterDPA
->
nItemCount
-
1
)))
return
NULL
;
pOpenedPrinter
=
WINSPOOL_DPA_GetPtr
(
pOpenedPrinterDPA
,
printerHandle
);
return
pOpenedPrinter
;
}
/******************************************************************
...
...
@@ -1012,7 +1046,12 @@ BOOL WINAPI ClosePrinter(HANDLE hPrinter)
{
LPOPENEDPRINTERA
lpOpenedPrinter
;
if
((
hPrinter
!=
-
1
)
&&
(
hPrinter
<
NUM_PRINTER_MAX
+
1
))
TRACE
(
"Handle %d
\n
"
,
hPrinter
);
if
(
!
pOpenedPrinterDPA
)
return
FALSE
;
if
((
hPrinter
!=
-
1
)
&&
(
hPrinter
<
(
pOpenedPrinterDPA
->
nItemCount
-
1
)))
{
lpOpenedPrinter
=
WINSPOOL_GetOpenedPrinterA
(
hPrinter
);
HeapFree
(
GetProcessHeap
(),
0
,
lpOpenedPrinter
->
lpsPrinterName
);
...
...
@@ -1031,7 +1070,7 @@ BOOL WINAPI ClosePrinter(HANDLE hPrinter)
}
lpOpenedPrinter
->
hPrinter
=
-
1
;
return
TRUE
;
}
return
FALSE
;
...
...
dlls/winspool/winspool.spec
View file @
6374cd23
name winspool
type win32
init WINSPOOL_EntryPoint
101 stub ADVANCEDSETUPDIALOG
102 stub AbortPrinter
...
...
dlls/winspool/wspool.c
0 → 100644
View file @
6374cd23
/******************************************************************************
* Print Spooler Functions
*
*
* Copyright 1999 Thuy Nguyen
*/
#include "commctrl.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL
(
winspool
)
HINSTANCE
hcomctl32
=
0
;
HDPA
(
WINAPI
*
WINSPOOL_DPA_CreateEx
)(
INT
,
HANDLE
);
LPVOID
(
WINAPI
*
WINSPOOL_DPA_GetPtr
)(
const
HDPA
,
INT
);
INT
(
WINAPI
*
WINSPOOL_DPA_InsertPtr
)(
const
HDPA
,
INT
,
LPVOID
);
/******************************************************************************
* WINSPOOL_EntryPoint
*
* Winspool entry point.
*
*/
BOOL
WINAPI
WINSPOOL_EntryPoint
(
HINSTANCE
hInstance
,
DWORD
reason
,
LPVOID
lpReserved
)
{
switch
(
reason
)
{
case
DLL_PROCESS_ATTACH
:
hcomctl32
=
LoadLibraryA
(
"COMCTL32.DLL"
);
WINSPOOL_DPA_CreateEx
=
(
void
*
)
GetProcAddress
(
hcomctl32
,
(
LPCSTR
)
340L
);
WINSPOOL_DPA_GetPtr
=
(
void
*
)
GetProcAddress
(
hcomctl32
,
(
LPCSTR
)
332L
);
WINSPOOL_DPA_InsertPtr
=
(
void
*
)
GetProcAddress
(
hcomctl32
,
(
LPCSTR
)
334L
);
break
;
case
DLL_PROCESS_DETACH
:
FreeLibrary
(
hcomctl32
);
break
;
}
return
TRUE
;
}
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