Compare commits

...

397 Commits

Author SHA1 Message Date
Katayama Hirofumi MZ
60c770db67 [SHELL32] Improve Japanese (ja-JP) translation
Just fix IDS_ANY_FILE. CORE-18706
2023-11-21 10:46:57 +09:00
Katayama Hirofumi MZ
a95863b132 [NETCFGX] Half-implement TCP/IP alternate configuration (#6009)
Based on KRosUser's netcfx_alt.patch.
- Remove WS_GROUP flag of IDC_NODHCP control.
- Fix the extent of a groupbox.
- Half-implement TcpipAltConfDlg function.
CORE-19331
2023-11-21 06:16:39 +09:00
Whindmar Saksit
51a89791c1 [RAPPS] Validate DisplayIcon value and support icon index (#5664)
- If the DisplayIcon value points to an invalid path, ExtractIconW()
  can return 1! ExtractIconExW() does not have this problem nor the -1 issue.
  Reference: https://devblogs.microsoft.com/oldnewthing/20050526-07/?p=35533
- Use the icon index from PathParseIconLocationW().

Addendum to c6c7fc1. CORE-19317

Test to reproduce:

```
@echo off
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex1 /v DisplayName /d "Ex1 Normal" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex1 /v DisplayIcon /d "%windir%\explorer.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex1 /v UninstallString /d "calc.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex2 /v DisplayName /d "Ex2 Bad icon path" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex2 /v DisplayIcon /d "%windir%\DoesNotExist.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex2 /v UninstallString /d "calc.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex3 /v DisplayName /d "Ex3 Resource index" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex3 /v DisplayIcon /d "%windir%\explorer.exe,4" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex3 /v UninstallString /d "calc.exe" /f
start appwiz.cpl
```
2023-11-20 20:50:42 +03:00
Stanislav Motylkov
4add3fd482 [REACTOS] Revert commit 32bdd85b7f (incorrectly formatted) 2023-11-20 20:50:06 +03:00
Whindmar Saksit
32bdd85b7f DisplayIcon needs to validate the result and support icon index (#5664)
Test:

@echo off
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex1 /v DisplayName /d "Ex1 Normal" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex1 /v DisplayIcon /d "%windir%\explorer.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex1 /v UnstallString /d "calc.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex2 /v DisplayName /d "Ex2 Bad icon path" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex2 /v DisplayIcon /d "%windir%\DoesNotExist.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex2 /v UnstallString /d "calc.exe" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex3 /v DisplayName /d "Ex3 Resource index" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex3 /v DisplayIcon /d "%windir%\explorer.exe,4" /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ex3 /v UnstallString /d "calc.exe" /f
start appwiz.cpl
2023-11-20 16:41:31 +00:00
Serge Gautherie
5a0cd3743e [WIDL] CMakeLists.txt: Remove an obsolete comment (#6016)
Addendum to 8184186 (r55855).
2023-11-20 16:07:46 +01:00
Katayama Hirofumi MZ
cbc60aa07a [NETSHELL] Double click on component should open properties (#6008)
Based on KRosUser's lanprop.patch. Add NM_DBLCLK handling.
CORE-19330
2023-11-20 21:48:18 +09:00
Katayama Hirofumi MZ
edaeef9418 [SHELL32] Fix exception on modifying deleted file type (#5996)
Based on KRosUser's filetypes.patch. Check NULL for pEntry.
CORE-19324
2023-11-20 09:27:06 +09:00
Justin Miller
516ccad340 [NTOS:KE][HALX86] Implement AP startup code (#5879)
Co-authored-by: Victor Perevertkin <victor.perevertkin@reactos.org>

Introduce the initial changes needed to get other processors up and into kernel mode. 
This only supports x86 as of now but is the first real step towards using other system processors.
2023-11-19 15:51:33 -08:00
Katayama Hirofumi MZ
9e42809fc1 [NETCFGX] Use CheckDlgButton/IsDlgButtonChecked instead of BM_GETCHECK/BM_SETCHECK
CORE-19331
2023-11-20 07:58:58 +09:00
George Bișoc
f3141fb29e [NTOS:CM] Implement support for alternate registry hives
Sometimes repairing a broken hive with a hive log does not always guarantee the hive
in question has fully recovered. In worst cases it could happen the LOG itself is even
corrupt too and that would certainly lead to a total unbootable system. This is most likely
if the victim hive is the SYSTEM hive.

This can be anyhow solved by the help of a mirror hive, or also called an "alternate hive".
Alternate hives serve the purpose as backup hives for primary hives of which there is still
a risk that is not worth taking. For now only the SYSTEM hive is granted the right to have
a backup alternate hive.

=== NOTE ===

Currently the SYSTEM hive can only base upon the alternate SYSTEM.ALT hive, which means the
corresponding LOG file never gets updated. When time comes the existing code must be adapted
to allow the possibility to use .ALT and .LOG hives simultaneously.
2023-11-19 20:44:29 +01:00
George Bișoc
279f8f8864 [CMLIB] Fix the bin during hive initialization from memory if it's corrupt
As we iterate over the chunk hive data pointer for hive bins that we are going
to enlist, we might encounter one or several bins that would get corrupted
during a premature abortion of a registry writing operation such as due to
a power outage of the system, hardware malfunction, etc.

Corruption at the level of hive bins is nasty because they contain actual cell
data of registry information such as keys, values etc. Assuming a bin is corrupt
in part we can fix it by recovering some of the bin properties that, theoretically,
could be fixed -- namely the signature, size and offset.

For size and offset we are more or less safe because a bin typically has a size
of a block, and the offset is the coordinate index of where a hive bin should lay at.
2023-11-19 20:44:29 +01:00
George Bișoc
27917c14ed [NTOS:CM] Flush the dirty data to disk if the SYSTEM hive has been recovered by FreeLdr
If FreeLdr performed recovery against the SYSTEM hive with a log, all of its data is only present in volatile memory thus dirty. So the kernel is responsible to flush all the data that's been recovered within the SYSTEM hive into the backing storage.
2023-11-19 20:44:29 +01:00
George Bișoc
fa80176a62 [FREELDR][HACK] Temporarily disable registry recovery code for AMD64
The newly implemented code for registry recovery makes the FreeLdr binary to grow
in size, to the point that it would BSOD because the PE image is too big.

For now we have to temporarily disable any of the newly added code, until
either FreeLdr is split into a basic PE bootloader image itself and a
"FreeLdrlib" that is used by the PE image to access various bootloader APIs
or another proper solution is found.
2023-11-19 20:44:28 +01:00
George Bișoc
7983b65e10 [FREELDR] Implement SYSTEM hive recovery at bootloader level & use CmCheckRegistry for registry validation
Validate the SYSTEM hive with CmCheckRegistry and purge volatile data with the same function when initializing a hive descriptor for SYSTEM.
Also implement SYSTEM recovery code that takes use of SYSTEM log in case something is fishy with the hive. If hive repair doesn't have fully recovered the SYSTEM hive, FreeLdr will load the alternate variant of the SYSTEM hive, aka SYSTEM.ALT.

If FreeLdr repairs the hive with a LOG, it will mark it with HBOOT_BOOT_RECOVERED_BY_HIVE_LOG on BootRecover field of the header. All the recovered data that is present as dirty in memory will have to be flushed by the kernel once it is in charge of the system.
Otherwise if the system boot occurred by loading SYSTEM.ALT instead, FreeLdr will mark HBOOT_BOOT_RECOVERED_BY_ALTERNATE_HIVE, the kernel will start recovering the main hive as soon as it does any I/O activity into it.
2023-11-19 20:44:28 +01:00
George Bișoc
cce399e772 [ROSLOAD] Use CmCheckRegistry to purge volatile data 2023-11-19 20:44:28 +01:00
George Bișoc
4db1b0fb62 [SDK][CMLIB] Purge volatile data of registry in a proper way with CmCheckRegistry
Thanks to CmCheckRegistry, the function can perform volatile data purging upon boot which this removes old hacky CmPrepareHive code. This also slightly refactors HvInitialize making it more proper.
2023-11-19 20:44:28 +01:00
George Bișoc
cc63d8f4a2 [SDK][CMLIB] Implement log transaction writes & Resuscitation
=== DOCUMENTATION REMARKS ===

This implements (also enables some parts of code been decayed for years) the transacted writing of the registry. Transacted writing (or writing into registry in a transactional way) is an operation that ensures the successfulness can be achieved by monitoring two main points.
In CMLIB, such points are what we internally call them the primary and secondary sequences. A sequence is a numeric field that is incremented each time a writing operation (namely done with the FileWrite function and such) has successfully completed.

The primary sequence is incremented to suggest that the initial work of syncing the registry is in progress. During this phase, the base block header is written into the primary hive file and registry data is being written to said file in form of blocks. Afterwards the seconady sequence
is increment to report completion of the transactional writing of the registry. This operation occurs in HvpWriteHive function (invoked by HvSyncHive for syncing). If the transactional writing fails or if the lazy flushing of the registry fails, LOG files come into play.

Like HvpWriteHive, LOGs are updated by the HvpWriteLog which writes dirty data (base block header included) to the LOG themselves. These files serve for recovery and emergency purposes in case the primary machine hive has been damaged due to previous forced interruption of writing stuff into
the registry hive. With specific recovery algorithms, the data that's been gathered from a LOG will be applied to the primary hive, salvaging it. But if a LOG file is corrupt as well, then the system will perform resuscitation techniques by reconstructing the base block header to reasonable values,
reset the registry signature and whatnot.

This work is an inspiration from PR #3932 by mrmks04 (aka Max Korostil). I have continued his work by doing some more tweaks and whatnot. In addition to that, the whole transaction writing code is documented.

=== IMPORTANT NOTES ===

HvpWriteLog -- Currently this function lacks the ability to grow the log file size since we pretty much lack the necessary code that deals with hive shrinking and log shrinking/growing as well. This part is not super critical for us so this shall be left as a TODO for future.

HvLoadHive -- Currently there's a hack that prevents us from refactoring this function in a proper way. That is, we should not be reading the whole and prepare the hive storage using HvpInitializeMemoryHive which is strictly used for HINIT_MEMORY but rather we must read the hive file block by block
and deconstruct the read buffer from the file so that we can get the bins that we read from the file. With the hive bins we got the hive storage will be prepared based on such bins. If one of the bins is corrupt, self healing is applied in such scenario.

For this matter, if in any case the hive we'll be reading is corrupt we could potentially read corrupt data and lead the system into failure. So we have to perform header and data recovery as well before reading the whole hive.
2023-11-19 20:44:27 +01:00
George Bișoc
d2b8b9ec96 [NTOS:CM] Use the appropriate flags on functions that will call CmCheckRegistry & add missing CmCheckRegistry calls
In addition to that, in some functions like CmFlushKey, CmSaveKey and CmSaveMergedKeys we must validate the underlying hives as a matter of precaution that everything is alright and we don't fuck all the shit up.
2023-11-19 20:44:27 +01:00
George Bișoc
f33da480af [SDK][CMLIB] Implement CmCheckRegistry and validation private helpers
CmCheckRegistry is a function that provides the necessary validation checks for a registry hive. This function usually comes into action when logs have been replayed for example, or when a registry hive internals have changed such as when saving a key, loading a key, etc.

This commit implements the whole Check Registry infrastructure (cmcheck.c) in CMLIB library for ease of usage and wide accessibility across parts of the OS. In addition, two more functions for registry checks are also implemented -- HvValidateHive and HvValidateBin.

Instead of having the CmCheckRegistry implementation in the kernel, it's better to have it in the Configuration Manager library instead (aka CMLIB). The benefits of having it in the library are the following:

- CmCheckRegistry can be used in FreeLdr to fix the SYSTEM hive
- It can be used on-demand in the kernel
- It can be used for offline registry repair tools
- It makes the underlying CmCheckRegistry implementation code debug-able in user mode

CORE-9195
CORE-6762
2023-11-19 20:44:27 +01:00
George Bișoc
54c552392f [SDK][CMLIB] Implement self-heal registry helpers
This implements cmheal.c file which provides the basic registry self-heal infrastructure needed by the public CmCheckRegistry function. The infrastructure provides a range of various self-heal helpers for the hive, such as subkey, class, values and node healing functions.
2023-11-19 20:44:27 +01:00
George Bișoc
586bea138e [CMLIB] Add STATUS_INVALID_PARAMETER and STATUS_REGISTRY_IO_FAILED status codes
Add these NTSTATUS codes in the CMLIB library. STATUS_INVALID_PARAMETER will be used mostly for HvInitialize function, STATUS_REGISTRY_IO_FAILED for whatever routines that deal with reading or writing into a hive file.
2023-11-19 20:44:26 +01:00
George Bișoc
bfcb28787d [NTOS:CM] Disable hard errors when setting up a new size for a hive file / annotate CmpFileSetSize parameters with SAL
During a I/O failure of whatever kind the upper-level driver, namely a FSD, can raise a hard error and a deadlock can occur. We wouldn't want that to happen for particular files like hives or logs so in such cases we must disable hard errors before toying with hives until we're done.

In addition to that, annotate the CmpFileSetSize function's parameters with SAL.
2023-11-19 20:44:26 +01:00
George Bișoc
0d776beac9 [NTOS:CM] Ignore syncing/flushing requests after registry shutdown
When shutting down the registry of the system we don't want that the registry in question gets poked again, such as flushing the hives or syncing the hives and respective logs for example. The reasoning behind this is very simple, during a complete shutdown the system does final check-ups and stuff until the computer
shuts down.

Any writing operations done to the registry can lead to erratic behaviors. CmShutdownSystem call already invokes a final flushing of all the hives on the backing storage which is more than enough to ensure consistency of the last session configuration. So after that final flushing, mark HvShutdownComplete as TRUE indicating
that any eventual flushing or syncying (in the case where HvSyncHive gets called) request is outright ignored.
2023-11-19 20:44:26 +01:00
George Bișoc
99fab7b905 [SDK][CMLIB] Declare some BootType and BootRecover identifiers & Miscellaneous Stuff
=== DOCUMENTATION REMARKS ===

HBOOT_TYPE_REGULAR and HBOOT_TYPE_SELF_HEAL are boot type values set up by the CMLIB library (for the BootType field respectively). HBOOT_TYPE_REGULAR indicates a normal system boot whereas HBOOT_TYPE_SELF_HEAL indicates the system boot is assisted within self healing mode.

Whether the former or the latter value is set it's governed by both the kernel and the bootloader. The bootloader and the kernel negotiate together to determine if any of the registry properties (the hive, the base block, the registry base, etc) are so severed from corruption or not. In extreme cases where
registry healing is possible, the specific base block of the damaged hive will have its flags marked with HBOOT_TYPE_SELF_HEAL. At this point the boot phase procedure is orchestrated since the boot phase no longer goes on the default path but it's assisted, as I have already said above.

HBOOT_NO_BOOT_RECOVER, HBOOT_BOOT_RECOVERED_BY_HIVE_LOG and HBOOT_BOOT_RECOVERED_BY_ALTERNATE_HIVE on the other hand are identifiers for the BootRecover field of the BASE_BLOCK header structure. These are used exclusively by FreeLdr to tell the kernel if the bootloader recovered the SYSTEM hive or not. In case where the bootloader did recover the SYSTEM hive,
the kernel will perform a flush request on the dirty data down to disk. The (almost) worse case FreeLdr could not repair the main hive by applying log data, it will load the alternate mirror version of the hive.

In addition to that, declare other miscellaneous CMLIB identifiers for log transaction writes purposes.
2023-11-19 20:44:23 +01:00
Serge Gautherie
2cc7eeb939 [HALX86] Add missing \n to DPRINT() calls (#5993)
And promote some DPRINT() to DPRINT1().
2023-11-19 19:44:46 +01:00
Serge Gautherie
d27ec14822 [PSDK][SHELLBTRFS] Get rid of FILE_INFO_BY_HANDLE_CLASS.MaximumFileInfoByHandlesClass (#6003)
Follow-up to commit 455f330 (see PR #5802).
'MaximumFileInfoByHandlesClass' was our typo.
2023-11-19 19:42:18 +01:00
Hermès Bélusca-Maïto
5ee1dc6113 [USETUP] Don't error out in case one tries to "delete" empty partition space.
Just... don't delete it ¯\_(ツ)_/¯
2023-11-19 16:44:34 +01:00
Andrei Miloiu
b578846d82 [DOC] Update Romanian translation notes (#5908) 2023-11-19 16:40:18 +01:00
Andrei Miloiu
84216a9ebc [MMSYS] Update Romanian (ro-RO) translation (#6001) 2023-11-19 16:39:10 +01:00
Andrei Miloiu
d6b7b7adad [COMDLG32] Update Romanian (ro-RO) translation (#6000) 2023-11-19 16:38:22 +01:00
Andrei Miloiu
a96573c4e5 [MSACM32] Update Romanian (ro-RO) translation (#5999) 2023-11-19 16:37:43 +01:00
Andrei Miloiu
fddc83ef9a [SHIMGVW] Update Romanian (ro-RO) translation (#5998) 2023-11-19 16:37:08 +01:00
Andrei Miloiu
af5a3ffedb [SHDOCLC] Update Romanian (ro-RO) translation (#5997) 2023-11-19 16:36:07 +01:00
Joachim Henze
4939936165 [NETCFGX] Strip 2x wrong WS_DISABLED style on dlgs (#5987)
I checked: those are not present in german XPSP3 for those dlgs.
I noticed that subtle thing just by the fact that the de-DE.rc had one
less of those compared to all other languages.
I don't know why those were added, but it is like that since eternity already,
e.g. see ebc7599c6d from ancient 2008 SVN r36325 times had them already.
2023-11-19 14:37:29 +00:00
Timo Kreuzer
aff1666356 [ADVAPI32] Improve handling of unaligned key name in RegOpenKeyExW
Check for unaligned buffer before calling NtOpenKey instead of checking the result for STATUS_DATATYPE_MISALIGNMENT.
2023-11-19 15:32:39 +02:00
Katayama Hirofumi MZ
f95c789f2b [SHELL32] Select 1st item after deletion of file type (#6007)
Based on KRosUser's filestypedel.patch.
- Select the first item after the user deleted a
  file type.
CORE-19325
2023-11-19 22:16:03 +09:00
Katayama Hirofumi MZ
ede60035f4 [CALC] Adapt to <strsafe.h> (#5894)
Use safer string functions of  <strsafe.h>.
Use StringCbPrintf instead of _stprintf.
Use StringCbCopy insteaad of _tcscpy.
Use StringCbCat instead of _tcscat.
CORE-19306
2023-11-19 21:46:00 +09:00
Katayama Hirofumi MZ
80c4856bba [INPUT] Implement advanced settings (#5864)
Allow the user to turn off "Advanced Text Service".
[HKEY_CURRENT_USER\Software\Microsoft\CTF]
"Disable Thread Input Manager"=dword:00000001
Implement AdvancedSettingsPageProc procedure.
Modify IDS_REBOOT_NOW resource string.
CORE-19268
2023-11-19 21:39:06 +09:00
Katayama Hirofumi MZ
b6a0ef10d2 [STOBJECT] Remove #if 0 and #endif in Volume_IsMute (#5973)
Based on KRosUser's volume.patch.
The pair of #if 0 and #endif was added in 180b6fb.
CORE-18583
2023-11-19 21:28:37 +09:00
Katayama Hirofumi MZ
d5cfd83789 [HOTPLUG] Update Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:51:59 +09:00
Katayama Hirofumi MZ
6a63d4a3c1 [DEVCPUX] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:44:25 +09:00
Katayama Hirofumi MZ
e2988b537a [DESKADP] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:39:30 +09:00
Katayama Hirofumi MZ
4aeaf747d1 [CRYPTEXT] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:34:39 +09:00
Katayama Hirofumi MZ
ef754b121a [ACPPAGE] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:29:56 +09:00
Katayama Hirofumi MZ
69d7adbebc [DESKMON] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:17:25 +09:00
Katayama Hirofumi MZ
da18e2893b [NETPLWIZ] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:12:17 +09:00
Katayama Hirofumi MZ
c9295fbeeb [STOBJECT] Add Japanese (ja-JP) translation
CORE-18706
2023-11-19 20:06:50 +09:00
Timo Kreuzer
e3f204e228 [CMAKE] Remove "/Gy" option from ML
Reason: VS solution builds pass the compiler options to the assembler. These are usually ignored and result in a warning only, but ML of the latest VS supports /Gy (function level linking), but that requires all functions to be declared with "PROC" and otherwise results in an error.
2023-11-19 09:19:33 +02:00
Katayama Hirofumi MZ
72081168fb [MSPAINT] Introduce partial image history (#5994)
- Add IMAGE_PART structure and use as history items.
- Overload ImageModel::PushImageForUndo(const RECT& rcPartial).
- Add ToolsModel::GetToolSize.
- Implement partial image history on TwoPointDrawTool.
CORE-19094
2023-11-19 12:59:39 +09:00
Katayama Hirofumi MZ
416d63026e [ACCESS] Improve IDC_RESET_COMBO selection (#5893)
Based on KRosUser's access.patch. CORE-19303
2023-11-19 10:33:18 +09:00
Andrei Miloiu
0a7a2824cf [WININET] Update Romanian (ro-RO) translation (#5992) 2023-11-18 22:41:25 +01:00
Andrei Miloiu
a6a617f96c [VGAFONTEDIT] Update Romanian (ro-RO) translation (#5991) 2023-11-18 22:40:18 +01:00
Andrei Miloiu
a9445f5ff6 [MPR] Update Romanian (ro-RO) translation (#5990) 2023-11-18 22:39:02 +01:00
Andrei Miloiu
444cff7b10 [NEWDEV] Update Romanian (ro-RO) translation (#5989) 2023-11-18 22:37:56 +01:00
Timo Kreuzer
455f330775 [KERNEL32_VISTA] Sync GetFileInformationByHandleEx with wine head 2023-11-18 17:53:42 +02:00
Timo Kreuzer
908cda5ee4 [KMTEST] Fix duplicated test names to stop testman from blowing up 2023-11-18 15:01:06 +02:00
Katayama Hirofumi MZ
764e5505a7 [MSPAINT] Add get/putSubImage in dib.cpp and use them
CORE-19094
2023-11-18 14:25:19 +09:00
Katayama Hirofumi MZ
a65ebc8a71 [MSPAINT] Fix PushImageForUndo (follow-up of 7c0615f)
CORE-19226, CORE-19237
2023-11-18 11:37:43 +09:00
Katayama Hirofumi MZ
a58aee5f5b [MSPAINT] Use Swap in RegistrySettings::SetMostRecentFile
CORE-19237
2023-11-18 11:23:13 +09:00
Katayama Hirofumi MZ
7c0615fa05 [MSPAINT] Split master image from history items
CORE-19237
2023-11-18 11:19:38 +09:00
Timo Kreuzer
bf95b7e8e5 [NTOS:CC] Do not access VACB after decrementing it's reference count
It might already be deleted by a different thread.
2023-11-17 20:07:55 +02:00
Katayama Hirofumi MZ
a2a063a282 [INETCPL] Let image list be automatically deleted (#5892)
Based on KRosUser's inetsec.patch.
Don't delete the image list because the image list will be automatically deleted by the list view.
CORE-19301
2023-11-17 10:11:41 +09:00
Katayama Hirofumi MZ
8860dc5393 [BOOTDATA] LiveCD: Enable Toggle key (Alt+Shift etc.) (#5985) 2023-11-16 22:23:11 +00:00
Serge Gautherie
780c2a0375 [SERVICES][SETUPLIB][UMANDLG][USETUP] Add missing \n to DPRINT() calls (#5983)
And promote 1 DPRINT() to DPRINT1.
2023-11-16 22:22:12 +00:00
Hermès Bélusca-Maïto
98353cdb37 [CMD] Use correct console input mode in ConInString()
ENABLE_PROCESSED_INPUT is necessary to correctly deal with CR-LF
and display it only when necessary. Fixes cmd:batch winetests.

Addendum to commit db219e45c
2023-11-16 21:58:54 +01:00
Serge Gautherie
a5c3bb5bce [WIN32KNT_APITEST] 2 minor code improvements and a first fix (#5980)
- Update .rc filename; addendum to 7ad21a4 (r70458).
- Move one '#include "resource.h"' around to where it is needed.
  Addendum to e1b2e7a (r29284) then ec5e0ea (r48103).
- Adjust all '#include <win32nt.h>'
2023-11-16 21:57:10 +01:00
George Bișoc
1d8ce79080 [NTDLL_APITEST] Write some tests for NtSetDefaultLocale 2023-11-16 21:09:08 +01:00
George Bișoc
6438b85605 [NTOS:EX] Bail out on an invalid locale or language ID
NtSetDefaultLocale and ExpSetCurrentUserUILanguage do not probe the given locale or language ID,
and as a result of that these functions would happily take any given argument. This is problematic
because overwriting NLS data (specifically the Default registry key value as its gets set by the
NtSetDefaultLocale syscall itself) with garbage stuff, rendering the system completely unbootable.

In addition to that, these functions do not check the captured language/locale ID against pre-determined
locales or languages pre-installed in the system. This basically means an ID of 1, for example, is still
valid because it is not bogus albeit there is no such a locale of an ID of 1. That value would get passed
to the Default value key and that renders the system unbootable as well.

CORE-18100
2023-11-16 21:09:05 +01:00
Hermès Bélusca-Maïto
db219e45c0 [CMD] Fix missing/misplaced newlines at end of displayed errors and prompts.
ConInString() should display a newline when it encounters the terminating
carriage-return pressed by the user for ending string output.
+ Remove the extra \n hacks in FilePromptYN[A].

Improve outputted strings from DATE and TIME commands.
+ Rename some STRING_***_ERROR defines.

CORE-18489
2023-11-16 17:06:40 +01:00
Hermès Bélusca-Maïto
cef9f5c4a6 [RTL] Minor formatting, remove redundant 'return'. 2023-11-16 17:06:40 +01:00
Andrei Miloiu
6a6b5ec22c [INF] Update Romanian (ro-RO) translation (#5969) 2023-11-16 13:34:43 +01:00
Andrei Miloiu
f61f3b0b00 [TASKKILL] Update Romanian (ro-RO) translation (#5954) 2023-11-16 13:33:55 +01:00
Katayama Hirofumi MZ
157739a658 [MSPAINT] s/AirBrushWidth/AirBrushRadius/
Fix logical error. CORE-19094
2023-11-16 15:45:06 +09:00
Katayama Hirofumi MZ
3faa56d2c7 [CRYPTUI] Let image list be automatically deleted (#5891)
Based on KRosUser's cryptui.patch.
- Don't delete the image list because the list view will delete the image list automatically.
CORE-17290
2023-11-16 14:58:49 +09:00
Serge Gautherie
24757e30e9 [NTDDRAW][NTGDI][VGADDI] Add missing \n to DPRINT() calls (#5952)
Add missing \n to DPRINT() calls and demote some DPRINT1().
2023-11-15 21:07:27 +01:00
Ratin Gao
bd0a5498b0 [NTDLL:LDR] Little fixes about SAL annotation and behavior (#5793)
- Uniform function declarations in .c and .h with fixes and SAL2 improvements.
- Use LDR_[UN]LOCK_LOADER_LOCK_FLAG_XXX correctly.
- Fix incorrect UsedSize calculation in LdrQueryProcessModuleInformationEx (caught by ThFabba).
- Whatever the callback request stop the enumeration or not in LdrEnumerateLoadedModules, the following operations should be the same.
- Fix 2 incorrect DPRINT1 that printed incorrect parameter.
- Return error if RtlAllocateHeap failed in LdrpGetProcedureAddress, and add comments about NT6.2 new changes.
2023-11-15 20:59:32 +01:00
Andrei Miloiu
bd9e2d6beb [FIND] Update Romanian (ro-RO) translation (#5965) 2023-11-15 11:27:09 +01:00
Whindmar Saksit
51ba3b1fb4 [SHELL32] Don't display missing applications in "Open with..." (#5587)
Don't display applications that don't exist. In Windows XP, Exe files that no longer exist are hidden but their registry entry is not deleted.

JIRA issue: CORE-19117
2023-11-15 11:20:04 +01:00
Whindmar Saksit
8025785730 [ADVAPI32] RegEnumKeyExW on HKCR keys must work with just KEY_ENUMERATE_SUB_KEYS access (#5872)
This fixes Windows RegEdit when the same HKCR key exists in HKCU and HKLM.
2023-11-15 11:07:28 +01:00
Andrei Miloiu
2414a21a38 [MSCONFIG_NEW] Update Romanian (ro-RO) translation (#5968) 2023-11-15 11:02:12 +01:00
Andrei Miloiu
08820b747e [EVENTVWR] Update Romanian (ro-RO) translation (#5979) 2023-11-15 11:01:46 +01:00
Andrei Miloiu
4ada65e875 [MSCONFIG] Update Romanian (ro-RO) translation (#5967) 2023-11-15 11:00:40 +01:00
Andrei Miloiu
1313179a32 [DEVMGR] Update Romanian (ro-RO) translation (#5960) 2023-11-15 10:59:48 +01:00
Andrei Miloiu
03dc2ef724 [REGEDIT] Update Romanian (ro-RO) translation (#5961) 2023-11-15 10:59:01 +01:00
Andrei Miloiu
86b6d9dff9 [FLTMC] Update Romanian (ro-RO) translation (#5956) 2023-11-15 10:57:50 +01:00
Andrei Miloiu
3b25db2f8e [DXDIAG] Update Romanian (ro-RO) translation (#5955) 2023-11-15 10:57:15 +01:00
Andrei Miloiu
f13a7de30c [MAGNIFY] Update Romanian (ro-RO) translation (#5964) 2023-11-15 10:56:39 +01:00
Andrei Miloiu
473cb2fe50 [SYSSETUP] Update Romanian (ro-RO) translation (#5957) 2023-11-15 10:55:37 +01:00
Andrei Miloiu
146d3f0bfe [SHELL32] Update Romanian (ro-RO) translation (#5962) 2023-11-15 10:52:26 +01:00
Andrei Miloiu
095791663d [SERVMAN] Update Romanian (ro-RO) translation (#5982) 2023-11-15 10:51:59 +01:00
Andrei Miloiu
5f25a55d64 [NOTEPAD] Update Romanian (ro-RO) translation (#5981) 2023-11-15 10:51:38 +01:00
Andrei Miloiu
e038927dd4 [MORE] Update Romanian (ro-RO) translation (#5966) 2023-11-15 10:51:21 +01:00
Andrew Shelkovenko
85ab39507f [TRANSLATION] Update Russian (ru-RU) translation (#5953)
- [CALC] Update Russian (ru-RU) translation
- [CHARMAP] Update Russian (ru-RU) translation
- [AT] Update Russian (ru-RU) translation
- [ATTRIB] Update Russian (ru-RU) translation
- [COMP] Improve Russian (ru-RU) translation
- [FC] Improve Russian (ru-RU) translation
- [FIND] Update Russian (ru-RU) translation
- [XCOPY] Update Russian (ru-RU) translation
- [FLTMC] Update Russian (ru-RU) translation

Reviewed-by: Oleg Dubinskiy <oleg.dubinskij30@gmail.com>
Reviewed-by: Stanislav Motylkov <x86corez@gmail.com>
2023-11-15 02:00:36 +03:00
Andrei Miloiu
1c56c9cd5f [MSTSC] Update Romanian (ro-RO) translation (#5959) 2023-11-14 14:00:32 +00:00
Andrei Miloiu
3ce9e3b669 [DESK] Update Romanian (ro-RO) translation (#5958) 2023-11-14 13:59:17 +00:00
Joachim Henze
b693eddd74 [TASKMGR] Harmonize and beautify the borders in performance tab (#5949)
- When I started I actually just wanted to make the 2 red lines the same length. see PR-pic
- Ultimately I was able to harmonize all ctrls sizes and position for all rc's.
- This does also fix text truncation and overflows in several rc's.
- Also this prevents the numbers (actual data) in some rc's to be cut off much earlier than in others,
  e.g. hu-HU.rc had IDC_KERNEL_MEMORY_PAGED width just 33 which is very small and will lead to quick truncation.
  Now all languages use width 45 for all data fields and width 57 for all text fields,
  which means if truncation would ever happen with very large numbers in the 64bit era,
  we will see that happen in all rc's at the same moment and not arbitrarily scattered over a century.
  It will happen later after this PR is applied.
- After this PR the two red lines do have the same length. see PR-pic
- After this PR the two green lines do have the same length. see PR-pic
- After this PR the two yellow lines do have the same length. see PR-pic
- After this PR the four brown lines do have the same length. see PR-pic
- After this PR the five cyan lines do have the same length. see PR-pic
2023-11-14 13:57:17 +00:00
Hermès Bélusca-Maïto
161eb5d375 [CRT] dbgrpt.cpp: Fix buffer sizes in the *nprintf functions (#5678)
Sizes are in number of chars; use _countof() instead of hardcoding
them in the functions.
2023-11-14 12:24:00 +01:00
Hermès Bélusca-Maïto
f49e213943 [CRT][MSVCRT] Implement _CrtDbgReport(W)V and redefine _CrtDbgReport(W) around those (#5678)
Also add the internal _VCrtDbgReportA and _VCrtDbgReportW functions listed in
https://learn.microsoft.com/en-us/cpp/c-runtime-library/internal-crt-globals-and-functions?view=msvc-170

CORE-11835, CORE-15517
2023-11-14 12:23:51 +01:00
Serge Gautherie
7901a4c8fe [WIN32KNT_APITEST] w32knapi.c: Update dll name (#5977)
Addendum to commits 7ad21a4 (r70458) and bed6d00 (r76026).
2023-11-14 12:14:39 +01:00
Katayama Hirofumi MZ
91adec683d [SHIMGVW] Add file extension on file save (#5975)
In order to add a filename extension if necessary,
set "png" to OPENFILENAME.lpstrDefExt.
CORE-19222
2023-11-14 19:48:18 +09:00
Serge Gautherie
3fb5957de1 [NTOS:EX][CSRSRV][WIN32K] Make a few #define more explicit/strict (#5907)
- Add parentheses around macro parameters.
- Add casts on return value for the Interlocked*UL ("Unsigned Long") macros.
2023-11-13 20:55:48 +01:00
Whindmar Saksit
e07dbf782c [NETSHELL] Display component icons in list (#5904)
Display the class icons for the installed network components.
Also fixes a bug where the selection change whacked the checkbox of the first item.

Use 0x7fffffff to append the item at the end of the list, as optimization.
2023-11-13 20:51:52 +01:00
Dmitry Borisov
8d7153c8ba [FREELDR] Implement NOSERIALMICE and FASTDETECT options (#5886)
Enable FASTDETECT by default, as done in NT 5+. This is because
the serial mouse is recognized by the serial stack since NT 5.x.
2023-11-13 19:49:41 +01:00
Hermès Bélusca-Maïto
10e7643c80 [FREELDR:NTLDR] Pass boot-time detection options to HwDetect routines.
Will be used for supporting /NOSERIALMICE, /FASTDETECT (NT 5+) switches
(see PR #5886), as well as the undocumented /PCIENUM option.
2023-11-13 19:19:40 +01:00
Whindmar Saksit
413b5a0827 [ADVAPI32] Handle HKEY_CLASSES_ROOT in RegQueryInfoKeyW (#5870)
CORE-8582 , CORE-14676

This fixes the bug where Regedit is unable to show all the keys in HKCR when a key exists in both HKCU and HKLM.
2023-11-13 18:02:41 +01:00
Whindmar Saksit
6eb8a1d0c7 [ADVPACK] Handle ADN_DEL_IF_EMPTY in DelNodeW and DelNodeRunDLL32 (#5821)
- Handling ADN_DEL_IF_EMPTY is critical to avoid data loss.
- SetFileAttributesW failing is not fatal, the delete might still succeed.

NOTE: Not in Wine yet.
2023-11-13 16:42:26 +01:00
Whindmar Saksit
f283a3f9ae [SHELL32][SHELLEXT] IEnumIDList::Next must handle pceltFetched and memory errors correctly (#5820)
- pceltFetched can be NULL if the caller is not requesting multiple items.
- All entries returned in rgelt must be valid, they cannot be NULL.
2023-11-13 16:31:37 +01:00
Hermès Bélusca-Maïto
b4b1c5b9aa [DEVMGR] Fix some bugs spotted by Thomas Faber in PR #5775 (#5790)
- Fix TCHAR/WCHAR mis-usage,
- Fix as a result, a buffer overflow (GlobalAlloc takes the size in
  bytes, but a number of characters was passed to it instead).
- Remove usage of unsafe string function. Now the item text is directly
  retrieved within the allocated buffer.
2023-11-13 16:26:00 +01:00
Whindmar Saksit
7fb91d98f9 [SHELL32] Add support for more registry verb flags and CMF flags (#5785)
- Adds support for registry controlled menu separators and the documented
  values to turn off verbs.
- Adds support for CMF_OPTIMIZEFORINVOKE, CMF_NODEFAULT, CMF_DONOTPICKDEFAULT,
  CMF_EXPLORE and CMF_DISABLEDVERBS.

Bugs fixed:

- A verb with "Extended" set in the registry could cause the menu to invoke
  the incorrect command! This happened because skipping InsertMenuItemW
  caused InvokeCommand to use the wrong index with m_StaticEntries.
- Uses IS_INTRESOURCE instead of HIWORD to check if something is a string
  (only matters on 64-bit).
- TryToBrowse leaking a PIDL when calling ILCombine.

Notes:

- This PR introduces the RosGetProcessEffectiveVersion() helper function
  discussed in chat.
- Relaxed FAILED_UNEXPECTEDLY to FAILED in two places because IContextMenu
  cannot assume that it has a site that leads to IShellBrowser.
2023-11-13 16:21:13 +01:00
Whindmar Saksit
23f31cf7b4 [SHELL32] Support more FOLDERFLAGS in DefView (#5760)
This adds support for more of the FOLDERSETTINGS FOLDERFLAGS.

- Turned on LVS_EX_DOUBLEBUFFER even though there is no setting for it.
  XP has it on for folders but not the desktop and this matches that.
  Vista might turn it on for its shadow labels on the desktop, further
  investigation required.

- Fixes a bug where LVS_EX_SNAPTOGRID was incorrectly assigned where
  the WS_EX flags go.

- LVS_AUTOARRANGE seems to be incorrectly forced on but for compatibility
  I decided to leave it but added a comment. The existing code already
  has the check for FWF_AUTOARRANGE.
2023-11-13 16:13:21 +01:00
Serge Gautherie
bac646f9fe [VMX_SVGA] Demote 3 DPRINT1() and define NDEBUG (#5843)
Addendum to 486e587 (r45778).
2023-11-13 11:11:10 +01:00
Whindmar Saksit
c6ec8d924e [ATL] Added CComPtr.CoCreateInstance helper methods (#5905) 2023-11-13 11:03:05 +01:00
Serge Gautherie
8d54c2d433 [WIN32U_VISTA] .def: Delete this obsolete file (#5931) 2023-11-13 11:01:31 +01:00
Jose Carlos Jesus
357189bdea [USETUP][SHELL32][ACCESS] Improve Portuguese (pt-PT) Translation (#5897) 2023-11-13 10:59:05 +01:00
Andrei Miloiu
6d7cc0d8ad [MORE] Update Romanian (ro-RO) translation (#5941) 2023-11-13 10:57:36 +01:00
Andrei Miloiu
cb8c554c4c [LABEL] Update Romanian (ro-RO) translation (#5939) 2023-11-13 10:55:16 +01:00
Andrei Miloiu
39bec4df92 [ATTRIB] Update Romanian (ro-RO) translation (#5936) 2023-11-13 10:53:36 +01:00
Andrei Miloiu
1d12f6135a [POWERCFG] Update Romanian (ro-RO) translation (#5934) 2023-11-13 10:53:03 +01:00
Andrei Miloiu
e743146a10 [FIND] Update Romanian (ro-RO) translation (#5937) 2023-11-13 10:51:38 +01:00
Joachim Henze
1997c12252 [NETCFGX] 640x480-ify (#5946)
This finishes the 640x480-ification within [NETCFGX]. All dlgs addressed now.

- Allows the final 3 property sheets IDD_TCPIP_ADVIP_DLG, IDD_TCPIP_ADVDNS_DLG and IDD_TCPIP_ADVOPT_DLG to be displayed fine in 640x480 screen resolution by limiting their dlg unit height to 220
- tweaks a bit of the controls vertical positions to look better, e.g. LTEXT "interface metric:" was moved one pix upwards relative to IDC_METRIC to make that look more vertically centered
- IDC_AUTOMETRIC checkbox was moved slightly upwards in relation to the groupbox it was embedded into, which does it make look slightly better
- width of IDC_SUFFIX was enlarged for all languages to the value that was historically chosen for uk-UA.rc. (Only ru-RU.rc continues to do that differently, as it uses even longer text and therefore has to shift 2 controls towards the left to make that fit into the dlg. That part was there also before this PR)
2023-11-13 01:56:38 +00:00
Hermès Bélusca-Maïto
ee11747527 [CRT] Fix "wcsat_s" typo... 2023-11-11 21:30:09 +01:00
Timo Kreuzer
83e1193fb2 [WIN32K] Fix alignment checks in NtUserSetInformationThread
Fixes random failures on x64.
2023-11-10 19:42:13 +02:00
Timo Kreuzer
6ca8eb5c1e [CMAKE] Update baseaddress cmake files 2023-11-10 19:20:24 +02:00
Timo Kreuzer
7377f14339 [GEN_BASEADDRESS] Add handling of 64 bit builds 2023-11-10 19:20:24 +02:00
Timo Kreuzer
9cc4d8994b [CMAKE] Use baseaddress64.cmake for all 64 bit builds
- Rename baseaddress_msvc_x64.cmake to baseaddress64.cmake
- Include it for all compilers and 64 bit architectures
2023-11-10 19:20:24 +02:00
Timo Kreuzer
2b7246fd3c [CMAKE] Add support for "IMAGEBASE default" and use it for test/sample dlls 2023-11-10 19:20:24 +02:00
Timo Kreuzer
58f1201eae [FUSION] Provide baseaddress for fusion_1_1 and fusion_2_0
These DLLs are also named fusion.dll. Give them the same baseaddress as fusion.dll
2023-11-10 19:20:24 +02:00
Timo Kreuzer
2245dd78f5 [ASMPP] Improve handling of rip relative addressing 2023-11-10 19:20:24 +02:00
Timo Kreuzer
a34f1ed03c [CRT] Make ML based asm code GAS compatible
Our transpiler asmpp cannot handle rip relative addressing for "[symbol]".
2023-11-10 19:20:24 +02:00
Timo Kreuzer
d4993c67cd [CRT] Fix parameter check for _memicmp on NT 6+
Fixes a crash in msvcrt_winetest:string
2023-11-10 19:19:22 +02:00
Timo Kreuzer
840dfdc3a1 [CRT] Add parameter check to _mbscmp
Fixes crash in msvcrt_winetest::string
2023-11-10 19:19:22 +02:00
Timo Kreuzer
86f98baaf8 [CRT][MSVCRT] Import _gcvt and _gcvt_s from wine and export _gcvt_s on Vista+
Fixes a crash in msvcrt_winetest string
2023-11-10 19:19:22 +02:00
Timo Kreuzer
a3d22bba1a [RTL_APITEST] Move RtlIntSafe test from kmtest to rtl_apitest 2023-11-10 19:00:41 +02:00
Timo Kreuzer
bdf52a9868 [RTL_APITEST] Add rtl_unittest
First test is RtlCaptureContext
2023-11-10 19:00:41 +02:00
Timo Kreuzer
51b5d846e9 [CRT] Define _NTSYSTEM_ in 2 files to force using import-stubs
This prevents the code from linking to __imp_*, which would pull in the symbol from the import library (e.g. kernel32), which creates problems with the GNU linker, which doesn't like to have the import and a static definition at the same time.
2023-11-10 19:00:41 +02:00
Timo Kreuzer
520cf2294d [APITESTS] Share ok_eq_* macros between apitests and kmtests
This makes it possible to share sources between kmtest and apitests, e.g. for rtl.
2023-11-10 19:00:41 +02:00
Timo Kreuzer
5ecead80e3 [RTL] Add object library rtl_um 2023-11-10 19:00:41 +02:00
Timo Kreuzer
4bd1e81998 [RTL] Get rid of x86 asm version of RtlpGetStackLimits
There is no point in writing this function in asm.
2023-11-10 19:00:41 +02:00
Joachim Henze
393a88a372 [POWERCFG] 640x480-ify and overhaul (#5933)
Main goal was making the dlg display well in 640x480 resolution.
Since the dialogs in that propsheet had very different sizes between the languages
that was a lot of work. Now all of the propsheet-dlgs are harmonized in size to 252x220.
Also I found a way to align some controls in a way that they are more immune
to differing languages lengths for specific strings, so we can currently
to 100% use the same controls dimensions and positions also,
which is a very nice trait. I double-checked all dialogs visually in ResHacker
for all languages (except no-NO.rc for technical reasons), and they do look all
very well like that. The slider for the alarms dlg I enlarged in x,
it has 100 distinct positions, so a larger slider helps the user
not having to position the mouse extremely accurate.
I also fixed various typos, and several places where text cutoff occurred for many languages,
too many to name them all.
Some dummy-strings "unknown" I changed to "?" instead.
That still allows to see its position in a previewer,
but does not lure all the translators into translating that nonsense,
and therefore keeps the rcs better in sync. It also shrinks binary size.
2023-11-09 23:33:17 +00:00
Andrei Miloiu
565bf9e340 [CMD] Update Romanian (ro-RO) translation (#5918) 2023-11-08 20:11:03 +01:00
Andrei Miloiu
3666f2bdbc [IEFRAME] Update Romanian (ro-RO) translation (#5923) 2023-11-08 20:07:04 +01:00
Andrei Miloiu
a575921e93 [LOCALMON] Update Romanian (ro-RO) translation (#5925) 2023-11-08 20:06:16 +01:00
Andrei Miloiu
df24297a10 [INPUT] Update Romanian (ro-RO) translation (#5930) 2023-11-08 20:05:17 +01:00
Andrei Miloiu
dd8029fd0e [SNDREC32] Update Romanian (ro-RO) translation (#5916) 2023-11-08 20:04:46 +01:00
Andrei Miloiu
f1e1ca4ad7 [WORDPAD] Update Romanian (ro-RO) translation (#5917) 2023-11-08 20:04:18 +01:00
Andrei Miloiu
51cc0019f7 [CLIPBRD] Update Romanian (ro-RO) translation (#5909) 2023-11-08 20:01:58 +01:00
Andrei Miloiu
3285d2c769 [MSPAINT] Update Romanian (ro-RO) translation (#5913) 2023-11-08 20:01:21 +01:00
Andrei Miloiu
aca3f92a47 [CONSOLE] Update Romanian (ro-RO) translation (#5919) 2023-11-08 19:59:07 +01:00
Andrei Miloiu
5ee25ee392 [DXDIAG] Update Romanian (ro-RO) translation (#5910) 2023-11-08 19:58:21 +01:00
Andrei Miloiu
328a5d87b0 [HDWWIZ] Update Romanian (ro-RO) translation (#5921) 2023-11-08 19:57:40 +01:00
Andrei Miloiu
c6ed289383 [RASDLG] Update Romanian (ro-RO) translation (#5924) 2023-11-08 19:57:02 +01:00
Joachim Henze
7cd1e606df [OPENGLCFG] 640x480-ify (#5906)
A simple one
2023-11-08 14:44:31 +01:00
Andrei Miloiu
416e6ef814 [MYEVENTPROVIDER_DLL][MC] Update MyEventProvider.mc (#5929) 2023-11-08 11:18:07 +00:00
Andrei Miloiu
d7b7d36721 [NETEVENT][MC] Update neteventmsg.mc (#5928) 2023-11-08 11:16:58 +00:00
Andrei Miloiu
6e9d798833 [NETMSG][MC] Update net_msg.mc (#5927) 2023-11-08 11:14:59 +00:00
Andrei Miloiu
46f67b1970 Update net_msg.mc (#5926) 2023-11-08 11:13:17 +00:00
Andrei Miloiu
ff0b63ff2e [INETCPL] Update Romanian (ro-RO) translation (#5922) 2023-11-08 11:05:06 +00:00
Katayama Hirofumi MZ
c6c7fc1182 [RAPPS] Fix item icons (#5896)
Based on KRosUser's rapps_v2.patch.
ExtractIconW can return (HICON)1.
We check this invalid value.
CORE-19317
2023-11-08 19:53:02 +09:00
Andrei Miloiu
97bf53eeb8 [DESK] Update Romanian (ro-RO) translation (#5920) 2023-11-08 10:43:14 +00:00
Andrei Miloiu
2b910fc1b3 [NOTEPAD] Update Romanian (ro-RO) translation (#5915) 2023-11-08 10:34:25 +00:00
Andrei Miloiu
1795049341 [MSTSC] Update Romanian (ro-RO) translation (#5914) 2023-11-08 10:32:38 +00:00
Andrei Miloiu
692c0141d3 [MMC] Update Romanian (ro-RO) translation (#5912) 2023-11-08 10:26:33 +00:00
Andrei Miloiu
1e1b176493 [SOLITAIRE] Update Romanian (ro-RO) translation (#5911) 2023-11-08 10:24:05 +00:00
Timo Kreuzer
dfcf07b825 [NTOS:KE/x64] Remove GCC vs ML hack 2023-11-07 23:16:50 +02:00
Joachim Henze
adeaba1604 [ACCESS] 640x480-ify (#5903)
The first dlg IDD_PROPPAGEKEYBOARD is the toughest.
All others had plenty of space left.
2023-11-07 12:25:44 +00:00
Joachim Henze
0177b1af45 [NETCFGX] *.rc 640x480-ify IDD_TCPIP_BASIC_DLG and IDD_TCPIP_ALTCF_DLG (#5902)
Both dialogs can easily fit 640x480, like their twins from XPSP3 and 2k3sp2

For IDD_TCPIP_BASIC_DLG we can achieve that by just shrinking the upper groupbox in height by 10 units, and then move all controls below that by 10 units upwards. That doesn't require much brain, only diligence.

For IDD_TCPIP_ALTCF_DLG it is even easier, because the dlgs contents are small enough yet to still fit 640x480, so only the dlg itself must be shrinked for now. Later if more stuff will be added, we can perform pretty easy still by just moving everything a bit upwards. But we can leave that for later.

Fix a common typo in a 3rd dlg regarding a missing space before "(in order)". I decided to put that into this PR, because I didn't touch that dlgs dimensions yet. So the change is not mixed with position changes and therefore the review remains simple.

For ja-JP.rc fix a
-FONT 8, "MS Shell Dlg"
to
+FONT 9, "MS UI Gothic"
2023-11-07 03:17:01 +00:00
Joachim Henze
55563fa891 [NETSHELL] IDD_NETPROPERTIES must fit 640x480 CORE-19284 (#5899)
- adds 3 missing accelerators for zh-CN.rc, zh-HK.rc, zh-TW.rc for IDC_SHOWTASKBAR
- shrinks the dialog in y to fit on a 640x480 screen, like the XPSP3 and 2k3sp2 dlgs do
- for that some controls positions have to be slightly moved up (which cannot lead to text truncation here, guaranteed)
- only 3 controls change in size:
  - IDC_COMPONENTSLIST gets 3 units smaller in height, but is still larger than in XPSP3/2k3sp2. So it is still large enough
  - IDC_NETCARDNAME shrinks a bit in width, but is still larger than in XPSP3/2k3sp2, so what fits there will also fit for us
  - pushbutton IDC_CONFIGURE is slightly increased in width for all languages because that looks better
     except ru-RU.rc (which had the largest width) it is slightly smaller now, but still large enough.
     We can use the same width here now for all rcs!

- strip the lorem ipsum text from IDC_DESCRIPTION, which is never supposed to be displayed. That syncs all rcs in that line and slightly shrinks the binary size and fixes CORE-19284.

- add a FIXME comment for a missing accelerator in sv-SE.rc

*as a consequence all rcs do now use the exact same positions and sizes for all controls again, YIPPIE!*
The only exception that the dlg had before from that rule, was the ru-RU.rc IDC_CONFIGURE was larger in x.
But now that is not needed anymore.
2023-11-06 23:31:37 +00:00
Joachim Henze
561ad3c1d6 [ADVAPI32] Mute frequent taskmgr logspam CORE-18521 (#5888)
George explained that this is supposed to fail like that,
aka "works as designed". So let's at least mute this now,
as it is spammed with every taskmgr refresh cycle
and allows me to reduce logfile-sizes from ~50MB back to ~2MB
when building ros on ros.

err:(dll/win32/advapi32/wine/security.c:309) NtOpenProcessToken failed! Status c0000022.

Fixes CORE-18521

Also strip some EOL-whitespace in the file, and slightly improve the header.
2023-11-05 18:32:13 +01:00
Katayama Hirofumi MZ
0ae6a509b0 [SHLWAPI][SDK] Implement IContextMenu_Invoke (#5856)
- Modify shlwapi.spec.
- Add dll/win32/shlwapi/utils.cpp.
- Implement IContextMenu_Invoke function.
- Add it to <shlwapi_undoc.h>.
CORE-19278
2023-11-05 21:45:08 +09:00
Katayama Hirofumi MZ
43d6fdf2be [ACLUI] Let image list be automatically deleted (#5890)
Based on KRosUser's aclui.patch. The list view will automatically delete the image list.
Don't delete the image list in DestroySecurityPage function.
CORE-19187
2023-11-05 21:36:05 +09:00
Joachim Henze
7f80d5ee79 [CMLIB] Revert previous commit to avoid future merges of other devs
because George is having an open Draft PR since July 2022,
which might also touch this file on master in some years.
And it ofc is easier for me to revert my work now, then for him to
go through the great lengths of merging his work then.
2023-11-05 09:55:03 +01:00
Katayama Hirofumi MZ
1ae6cb7a96 [CALC] Use <winuser.rh> instead of <winuser.h> in resource.rc 2023-11-05 17:21:33 +09:00
Katayama Hirofumi MZ
6691cbe889 [REGEDIT] Use <winuser.rh> instead of <winuser.h> in regedit.rc
CORE-18876
2023-11-05 17:18:07 +09:00
Joachim Henze
f6de3881ca [CMLIB] UNIMPLEMENTED_ONCE less hand-knitted (#5889)
allows to get rid of static var PrintCount, at least visually in the code
2023-11-05 09:12:49 +01:00
Katayama Hirofumi MZ
efb9128c24 [NOTEPAD] Use <winuser.rh> instead of <winuser.h> in rsrc.rc
CORE-18837
2023-11-05 17:11:06 +09:00
Thamatip Chitpong
81ba804b55 [HOTPLUG] Trivial fixes (#5887)
- Update files header and copyright information
- Minor code formatting
2023-11-05 07:02:22 +07:00
Whindmar Saksit
4b03981846 [RAPPS] Improve LicenseType handling (#5809)
Tries now to map the "License" text set to "Freeware" to the
LICENSE_FREEWARE "LicenseType" so it is translated correctly (LoadString).

Fixes the following:

- If only the "License" field is set in the DB, nothing will change
  (this applies to 99% of the current entries in the DB).

- If both "LicenseType" and "License" are set, both will be used
  (no observable change in behavior): "Open Source (GPL v2)" etc.

- If only "LicenseType" is set, it will now display just the type
  "Freeware" instead of "Freeware ()".
  This is done only for "Freeware", because the others (the open source ones)
  have many variations. "OpenSource", "Open Source", "Open Source (GPL)" etc.
2023-11-04 22:08:10 +01:00
Whindmar Saksit
b3c1f652ec [NETSHELL] Register folder attributes as SFGAO_FOLDER, not SFGAO_CANDELETE (#5880)
On Windows the Network connections folder uses a binary value
and someone forgot about Little Endian when converting it to a DWORD.

Addendum to 7eb3fcf1d (r66485). CORE-9276

This issue has not been very visible because of bugs in CRegFolderEnum.
2023-11-04 17:40:22 +03:00
Whindmar Saksit
a6c838299c [NETSHELL] Call ReleaseWriteLock. Fixes CORE-18349 (#5881) 2023-11-04 15:19:10 +01:00
Katayama Hirofumi MZ
fa4b38d902 [MSPAINT] Localize g_ptStart and g_ptEnd into mouse.cpp
And move some ToolsModel code into mouse.cpp
CORE-19094
2023-11-04 23:00:43 +09:00
Katayama Hirofumi MZ
56828b82d9 [MSPAINT] Distinguish between icons and cursors (#5884)
- Convert icons/*_cur.ico to the cursor files (*.cur).
- The hot spot is (16, 16) (default).
- Rename icons/ folder as img/.
- Use LoadCursorW instead of LoadIconW
  for cursors.
- Use CURSOR statements for cursor files
  instead of ICON statements in rsrc.rc.
- I used GIMP to convert the icon files to the PNG files.
- I used RealWorld Cursor Editor to convert the PNG files to the cursor files.
CORE-19297
2023-11-04 22:15:43 +09:00
Katayama Hirofumi MZ
a938d19714 [SHELL32] Commonize CCopyToMenu and CMoveToMenu (#5873)
Reduce code. And correctly do the filename check.
CORE-18909
2023-11-04 21:56:15 +09:00
Katayama Hirofumi MZ
d21def4819 [MSPAINT] Use <winuser.rh> instead of <winuser.h> in rsrc.rc (#5883)
CORE-19094
2023-11-04 21:53:04 +09:00
Thamatip Chitpong
119057800e [HOTPLUG] Add device removal support (#5836) 2023-11-04 13:31:26 +01:00
Katayama Hirofumi MZ
b69a7460db [MSPAINT] Fix filter string UNICODE_NULL problem
Follow-up to #5882.
Some ATL CString do not append the string if there is
a UNICODE_NULL in the middle.
CORE-19094
2023-11-04 19:50:36 +09:00
Katayama Hirofumi MZ
640d67d12a [MSPAINT] Adapt to Unicode and <strsafe.h> (#5882)
- TCHAR --> WCHAR
- LPTSTR --> LPWSTR
- LPCTSTR --> LPCWSTR
- CString --> CStringW
- TEXT("...") --> L"..."
- _T("...") --> L"..."
- ::SendMessage( --> ::SendMessageW(
- ::GetWindowText( --> ::GetWindowTextW(
- ::SetWindowText( --> ::SetWindowTextW(
- Replace _tcscat with StringCchCatW.
- Replace _tcslen with wcslen.
etc. CORE-19094
2023-11-04 19:25:45 +09:00
Katayama Hirofumi MZ
d7e1bd2705 [IMM32] Sort imm32.spec
CORE-19268
2023-11-04 05:59:53 +09:00
Katayama Hirofumi MZ
4aa1bcb72b [IMM32][SDK] Implement software keyboard, Part 1 (#5865)
- Add dll/win32/imm32/softkbd.c source file.
- Half-implement ImmCreateSoftKeyboard function.
- Move ImmShowSoftKeyboard, and ImmDestroySoftKeyboard functions.
- Modify ImmCreateSoftKeyboard prototype.
CORE-19268
2023-11-04 05:58:17 +09:00
Katayama Hirofumi MZ
d7ece626cb [MSPAINT] Fix Copy-To-File feature (#5877)
The Copy-To-File feature had some bugs that the user couldn't save.
- Modify SelectionModel::GetSelectionContents.
- Delete SelectionModel::CopyBitmap, SelectionModel::LockBitmap,
  and SelectionModel::UnlockBitmap functions.
CORE-19186
2023-11-04 05:56:10 +09:00
Katayama Hirofumi MZ
e627c3b00e [W32TIME] Remember date/time sync settings (#5866)
Based on KRosUser's patch.
- In the W32TmServiceMain function, the
  time check loop does check the registry value.
CORE-19292
2023-11-03 22:56:58 +09:00
Katayama Hirofumi MZ
eb4d13c823 [IMM32][SDK] Implement CtfImm(Hide,Restore)ToolbarWnd (#5863)
- Add Imm32GetFn helper function.
- Implement CtfImmHideToolbarWnd and
  CtfImmRestoreToolbarWnd functions.
- Add them to <imm32_undoc.h>.
CORE-19268
2023-11-03 22:45:51 +09:00
Katayama Hirofumi MZ
a114169c4d [MSPAINT] Refactor mouse moving code on canvas (#5878)
Move some mouse moving code to toolsModel.
CORE-19094
2023-11-03 22:41:06 +09:00
Katayama Hirofumi MZ
a6418c848c [MSPAINT] Simplify tool creation (#5876)
Reduce code and binary size. This will reduce 512 bytes in binary.
- Don't use cache for tool creation.
CORE-19094
2023-11-03 16:49:13 +09:00
Katayama Hirofumi MZ
37f56d2448 [MSPAINT] Commonize OnFinishDraw and OnCancelDraw (#5875)
Reduce code and binary size a bit. This will reduce 1024 bytes in binary.
Unify ToolBase::OnFinishDraw and ToolBase::OnCancelDraw to ToolBase::OnEndDraw.
CORE-19094
2023-11-03 16:20:03 +09:00
Joachim Henze
32b883ef2f [NOTEPAD] de-DE.rc: Fix CMD_HELP_ABOUT_NOTEPAD, all rc: strip bloat-spaces before \n and ? 2023-11-03 02:19:34 +01:00
Katayama Hirofumi MZ
17530af261 [MMSYS] Improve Japanese (ja-JP) translation
CORE-18706
2023-11-03 08:53:36 +09:00
Serge Gautherie
c6c6c62cb5 [PORTCLS] Remove meaningless YDEBUG (#5858)
Addendum to b77ebc4 (r54584).
Follow-up of #5818.
2023-11-02 13:14:12 +01:00
Katayama Hirofumi MZ
dabb3f4d61 [IMM32][SDK] Add CtfAImmIsIME, CtfImmSetAppCompatFlags etc. (#5862)
- Add CtfAImmIsIME, CtfImmIsCiceroStartedInThread and CtfImmSetAppCompatFlags functions.
- Implement CtfImmDispatchDefImeMessage function.
- Modify imm32.spec.
- Add the prototypes of ImmGetAppCompatFlags, CtfAImmIsIME, CtfImmIsCiceroStartedInThread,
  CtfImmSetAppCompatFlags, and CtfImmDispatchDefImeMessage into <imm32_undoc.h>.
CORE-19268
2023-11-02 08:16:12 +09:00
Egor Ananyin
64997887eb [NTUSER] Fix system menu mouse handing (#5822)
Add a check for the system menu opened from the app icon.
Fixes CORE-19258
2023-11-01 23:11:46 +00:00
Andrei Miloiu
c1b12b3f46 [SHELL32] Update Romanian (ro-RO) translation (#5838) 2023-11-01 16:56:50 +01:00
Justin Miller
0a951f1112 [BOOTDATA] Add SMP Entry (#5859)
[HALX86] Enable SMP Hal for x86
[BOOTDATA] add livecd and set entrys
2023-11-01 06:43:44 -07:00
Whindmar Saksit
5d1be078f8 [TASKMGR] Hold Shift to bypass MessageBox confirmation (#5845)
Allow the user to hold shift to automatically answer IDYES when killing/debugging a process or changing the priority.
2023-11-01 13:43:33 +01:00
Serge Gautherie
31876ba8c2 [DSOUND_NEW][HDAUDBUS] Replace meaningless YDEBUG (#5857)
and move debug.h after all includes. Addendum to 60b0afc3a (PR #5818)

dsound_new: Addendum to 5974fe1 (r45584).
hdaudbus: Addendum to cf7fc81 (r68311).
2023-11-01 13:39:05 +01:00
Katayama Hirofumi MZ
b3194e320c [IMM32][SDK] Add CtfAImmActivate/Deactivate functions (#5835)
- Add dll/win32/imm32/CtfImeTable.h for CTF
  IME functions.
- Implementing Imm32CheckAndApplyAppCompat,
  Imm32LoadCtfIme, and
  Imm32EnumCreateCtfICProc helper functions.
- Add CtfAImmActivate and CtfAImmDeactivate
  functions.
- s/CI_TFSDISABLED/CI_TSFDISABLED/
CORE-19268
2023-10-31 22:45:28 +09:00
Katayama Hirofumi MZ
25b7447818 [SETUPLIB][NTUSER] Toggle input language/layout on Alt+Shift / Ctrl+Shift (#5839)
- Respect the toggle key settings.
- Change the hot key settings in 
  base/setup/lib/mui.c.
- Revert IntDefWindowProc function about
  Alt+Shift handling.
- Delete some code in
  co_IntProcessKeyboardMessage for Alt+Shift
  handling.
- Add IntGetNextKL, IntLanguageToggle, and
  IntCheckLanguageToggle helper functions.
- Modify ProcessKeyEvent and
  UserGetLanguageToggle functions to
  support [Left Alt]+Shift and Ctrl+Shift.
- Improve WM_INPUTLANGCHANGEREQUEST
  handling.
- Message handling shouldn't access kbswitch
  directly.
CORE-10667
2023-10-31 22:37:49 +09:00
Katayama Hirofumi MZ
8a049d0b68 [SHELL32][SDK] Implement CopyStreamUI (#5848)
- Modify shell32.spec.
- Add CopyStreamUI prototype to <undocshell.h>.
CORE-19278
2023-10-31 22:32:02 +09:00
Serge Gautherie
60b0afc3af [BDASUP][KMIXER][MMIXER][STREAM] Replace meaningless YDEBUG (#5818)
bdasup: Addendum to 40c15ec (r46632).
kmixer: Addendum to 3e489bf (r42143).
mmixer: Addendum to c42d9f2 (r44872).
stream: Addendum to 4a0debf (r41662).
Serge plans a follow up that will remove all other remaining YDEBUG in the source tree.
The ones covered here he considered to be the most trivial ones.
2023-10-31 12:04:24 +00:00
Katayama Hirofumi MZ
6d7aaaade0 [MSPAINT] Delete needless ImageModel::ResetToPrevious
CORE-19094
2023-10-31 11:13:54 +09:00
Katayama Hirofumi MZ
ad12c6cdea [NTUSER] Disable SC_MOVE if WS_MAXIMIZE or WS_MINIMIZE (#5855)
Based on KRosUser's scmove.patch.
- Check also WS_MINIMIZE window style to
  determine to disable SC_MOVE system command.
CORE-19272
2023-10-31 06:50:00 +09:00
Katayama Hirofumi MZ
00f192fa94 [SHELL32] Improve file properties dialog (#5852)
Based on KRosUser's patches.
- Add missing version strings "Comments" and
  "LegalTrademarks".
- Add version strings "PrivateBuild" and
  "SpecialBuild" if necessary.
- Trim the version string for pretty display.
CORE-19270, CORE-19114, CORE-19275
2023-10-30 15:34:03 +09:00
Katayama Hirofumi MZ
87f94aa10c [KBSWITCH] Update layout list on WM_NOTIFYICONMSG
The layout list was not updated correctly.
CORE-10667
2023-10-30 10:40:27 +09:00
Katayama Hirofumi MZ
aed376e00f [MSPAINT] Fix ImageModel::PushImageForUndo bug
CORE-19274
2023-10-30 07:41:57 +09:00
Hermès Bélusca-Maïto
bdae8cf966 [SHLWAPI_APITEST] Fix MSVC compilation warning C4309
SHPropertyBag.cpp(161): warning C4309: 'initializing': truncation of constant value

See https://stackoverflow.com/questions/33333448/warning-c4309-what-does-it-mean-and-can-it-be-ignored-in-this-case
for some details.
2023-10-28 18:19:04 +02:00
Hermès Bélusca-Maïto
46ab34662d [BROWSEUI] Some parenthesizing clarification around "xxx & YYY" expressions in conditionals 2023-10-28 17:56:55 +02:00
Hermès Bélusca-Maïto
64f40e7f30 [BROWSEUI] Fix MSVC compilation warning C4805
internettoolbar.cpp(714): warning C4805: '!=': unsafe mix of type 'bool' and type 'BOOL' in operation
2023-10-28 17:50:26 +02:00
Hermès Bélusca-Maïto
c9c6902f08 [USETUP] Further simplify partition creation UI code (#5837)
- Use the same keypress 'C' to create either primary or logical partitions.
  Their type is automatically determined, whether they are created in
  general unpartitioned space, or space within an extended partition.

- Extensively adapt the translations to reflect these changes.
2023-10-28 17:08:42 +02:00
Hermès Bélusca-Maïto
ebcf3cf38e [USETUP] Blur the boundaries between MBR "Primary" and "Logical" partitions (#5837)
Do not do that yet for extended partitions (containers).

This is possible, because when creating partitions, we do that on
unpartitioned space that is already "tagged" as either being "logical"
or not, and the partition style is inherited from that.

The resulting code is simpler, yet working as it should.
This will also help in the future for supporting other platforms, where
the concept of "primary", "extended" and "logical" partitions do not
exist (basically all platforms except BIOS-based PC-AT).
2023-10-28 17:08:41 +02:00
Hermès Bélusca-Maïto
9ed4bf1ed7 [USETUP] Show the partition description (and its disk) being formatted and checked (#5837)
And improve some strings -- Translations need to be rechecked!
2023-10-28 17:08:40 +02:00
Hermès Bélusca-Maïto
06e4f13653 [USETUP] Simplify partition creation UI code (#5837)
Unify CREATE_{PRIMARY,EXTENDED,LOGICAL}_PARTITION_PAGE
(i.e. Create{Primary,Extended,Logical}PartitionPage() functions)
into a single CREATE_PARTITION_PAGE (i.e. CreatePartitionPage()).

A lot of code was duplicated there (display, size input, etc.) just
for calling ultimately the Create{Primary,Extended,Logical}Partition()
helper functions.

This will also help in the future for supporting other platforms, where
the concept of "primary", "extended" and "logical" partitions do not
exist (basically all platforms except BIOS-based PC-AT).
2023-10-28 17:08:39 +02:00
Hermès Bélusca-Maïto
1899a09399 [USETUP] Simplify display of partitions being formatted (#5837) 2023-10-28 17:08:39 +02:00
Hermès Bélusca-Maïto
3d4f001084 [USETUP] Rename some MUI string identifiers (#5837)
STRING_CHOOSENEWPARTITION --> STRING_CHOOSE_NEW_PARTITION
STRING_FORMATTINGDISK     --> STRING_FORMATTINGPART
STRING_HDDSIZE            --> STRING_HDPARTSIZE
STRING_HDINFOPARTCREATE_1 --> STRING_HDDISK1
STRING_HDINFOPARTDELETE_1 --> STRING_HDDISK2
STRING_HDDINFO_{1,2}      --> STRING_HDDINFO{1,2}

Move STRING_NEWPARTITION just before STRING_PARTFORMAT
and renumber the STRING_* identifiers.
2023-10-28 17:08:38 +02:00
Katayama Hirofumi MZ
128e7f5aea [SHELL32][SDK] Implement SHStartNetConnectionDialogA (#5847)
and add SHStartNetConnectionDialog prototype to <shlobj.h>.
2023-10-28 22:29:05 +09:00
Katayama Hirofumi MZ
a52c713755 [SHELL32][SDK] Follow-up of #5840 (ad5df2d)
Fix the parameters of Activate_RunDLL.
2023-10-28 21:31:11 +09:00
Katayama Hirofumi MZ
ad5df2d199 [SHELL32][SDK] Implement Activate_RunDLL (#5840)
- Add Activate_RunDLL function implementation.
- Add Activate_RunDLL prototype to <undocshell.h>.
2023-10-28 14:56:27 +09:00
Katayama Hirofumi MZ
2ccdd87809 [SHELL32][SDK] Implement ShortSizeFormatW (#5829)
- Implement ShortSizeFormatW.
- Add ShortSizeFormatW prototype into <undocshell.h>.
- Modify shell32.spec.
2023-10-28 14:55:25 +09:00
Katayama Hirofumi MZ
81e936486e [SHELL32] Implement ExtractIconResInfoA (#5846)
- Add ExtractIconResInfoA implementation.
- Add ExtractIconResInfo prototype to <undocshell.h>.
2023-10-28 11:38:29 +09:00
Katayama Hirofumi MZ
9dfb3e8e05 [SHELL32][SDK] Implement PathIsSlowA and SHSetFolderPathA (#5841)
- Implement PathIsSlowA and SHSetFolderPathA functions.
- Add PathIsSlow and SHSetFolderPath prototypes to <shlobj.h>.
- Fix some <shlobj.h>'s bugs.
- Improve SHOpenPropSheetA function.
2023-10-28 09:59:12 +09:00
Katayama Hirofumi MZ
dcc9a2d8f3 [SHELL32][SDK] Implement SHOpenPropSheetA (#5830)
- Add SHOpenPropSheetA and
  SHOpenPropSheetW prototypes to <shlobj.h>.
- Implement SHOpenPropSheetA function.
2023-10-27 19:34:02 +09:00
Katayama Hirofumi MZ
8f6b016963 [SHELL32] Fix copyto/moveto actions of Search Results (#5816)
- Extend CDefView::InvokeContextMenuCommand 2nd parameter to LPCSTR.
- Add CDefView::_DoCopyToMoveToFolder method.
- Use CDefView::_DoCopyToMoveToFolder for FCIDM_SHVIEW_COPYTO
  and FCIDM_SHVIEW_MOVETO command actions.
CORE-18426
2023-10-27 12:34:51 +09:00
Doug Lyons
4eace8d762 [IPHLPAPI] Silence obsolete FIXME in GetAdaptersAddresses (#5834) 2023-10-26 16:45:44 +00:00
Katayama Hirofumi MZ
995f56d1d3 [SHELL32][SDK] Implement IsSuspendAllowed (#5831)
- Add IsShutdownAllowed helper function.
- Add IsSuspendAllowed prototype to
  <undocshell.h>.
- Implement IsSuspendAllowed function.
2023-10-26 23:27:45 +09:00
Katayama Hirofumi MZ
be8a6f8af1 [REGEDIT] Improve error handling (#5833)
- Don't exit the main program on error.
- Improve output_message function.
- Use output_message instead of some
  error_exit function calls.
CORE-19188
2023-10-26 19:57:42 +09:00
Katayama Hirofumi MZ
fea414b9ed [REGEDIT] Use <strsafe.h> functions strictly Part 2 (#5832)
Follow-up to #5825. Use StringCchPrintfW instead of swprintf.
CORE-18876
2023-10-26 10:39:12 +09:00
Katayama Hirofumi MZ
8cef980ab9 [REGEDIT] Use <strsafe.h> functions strictly (#5825)
Use safer functions for buffer manipulation to avoid buffer overflow/overrun.
CORE-18876
2023-10-26 10:09:31 +09:00
Joachim Henze
9360423cc2 [SYSSETUP] syssetup.rc improve URLs (#5810)
Reformat those URLs in a way that allows new lines to be added, or
existing lines to be removed or changed,
without the need to touch any neighbor line.
This will also allow git blame to work much better in the future.

Fix outdated URLs:
http://www.icu-project.org -> http://icu.unicode.org
https://fedorahosted.org/liberation-fonts -> http://pagure.io/liberation-fonts

I checked: all of the URLs do still work as good as before.

* Update ext2fsd links in syssetup.rc and media/doc
2023-10-24 20:59:28 +00:00
Timo Kreuzer
d831bc4fab [NTOS:MM] Add ASSERTs for VAD table locking 2023-10-24 21:45:27 +03:00
Timo Kreuzer
23589e9bf1 [NTOS:MM] Lock kernel address space in MiInitSystemMemoryAreas
This is required to satisfy VAD locking rules.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
07ad8c4c11 [NTOS:MM] Attach to the target process in MmMapViewOfSection
This is required to satisfy VAD locking rules.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
601bb49c0d [NTOS:MM] Fix MmFreeMemoryArea
- Stay attached while deleting the VAD node
- Acquire the appropriate working set lock when deleting a VAD node
- Both are needed for locking correctness
2023-10-24 21:45:27 +03:00
Timo Kreuzer
de3958dc2b Revert "[NTOS:MM/x64] Temporarily release AddressCreationLock in MmCreateVirtualMappingUnsafeEx"
This reverts commit e685b25e35.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
a662bedab8 [NTOS:MM] Fix bugs in MmAccessFault
- Acquire the appropriate working set lock when calling MmLocateMemoryAreaByAddress
- Do not access MemoryArea without holding the lock (otherwise it can be pulled away under our feet)
- Fix range check for paged pool
2023-10-24 21:45:27 +03:00
Timo Kreuzer
84d0586ca4 [NTOS:MM] Handle page table faults in MmArmAccessFault
These faults are handled by ARM³ and we don't need to check for a memory area. They can be recursive faults (e.g. from MiDeleteSystemPageableVm), so we might be holding the WS lock already. Passing it straight to ARM³ allows to acquire the WS lock below to look up the memory area.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
a8b57f0a6b [NTOS:MM] Fix address space locking in MiProtectVirtualMemory 2023-10-24 21:45:27 +03:00
Timo Kreuzer
6d701b4b05 [NTOS:MM] Add ASSERTS to MmLockAddressSpace to guarantee lock ordering 2023-10-24 21:45:27 +03:00
Katayama Hirofumi MZ
ab199cc147 [MSPAINT] Show out-of-memory message (#5817)
- Improve ImageModel::PushImageForUndo.
- Use FormatMessage in newly added
  ShowOutOfMemory function.
- Call ShowOutOfMemory() when out of memory.
CORE-19227, CORE-19094
2023-10-25 02:35:49 +09:00
Hermès Bélusca-Maïto
501c2bdd63 [NTOS:LPC] Fix input parameter for ProbeAndCaptureUnicodeString (#5815)
Addendum to commit b3c55b9e6 (PR #4399).

Passing &CapturedObjectName as pointer to be probed and captured would
fail if e.g. PreviousMode == UserMode, since that pointer is always in
kernel space. Instead, pass the original user-mode pointer.

Bug caught by Timo Kreuzer ;)
2023-10-23 18:18:45 +02:00
Serge Gautherie
5b54477d47 [BDASUP][PORTCLS][SYSAUDIO][USB] Use ExAllocatePoolZero() and ExFreePoolWithTag() (#5811) 2023-10-23 18:16:59 +02:00
Thamatip Chitpong
7f5c59a0b3 [HOTPLUG] Add device properties dialog support (#5812)
Clicking at "Properties" button or right-click menu now opens properties dialog for the selected device.
2023-10-23 18:53:08 +07:00
Katayama Hirofumi MZ
6f86e11aa2 [SHELL32] Revert CDefView change at bc70af4
CORE-18426
2023-10-23 08:13:29 +09:00
Katayama Hirofumi MZ
bc70af4c13 [SHELL32] Use IS_INTRESOURCE in CCopyToMenu/CMoveToMenu::InvokeCommand
CORE-18426
2023-10-23 07:55:24 +09:00
Jesús Sanz del Rey
855008d97b [COMCTL32] Invalidate LVIS_CUT selected items too (#4218)
This fixes icons that should be drawn transparently not showing as such until window gets repainted.
For example, hidden shell folders that are not drawn transparently until the filebrowser window is resized...

CORE-16722
2023-10-21 18:51:54 +02:00
Serge Gautherie
c03b2ed9be [HDAUDBUS][KS][WDMAUD] Use ExAllocatePoolZero() and ExFreePoolWithTag() (#5792)
And promote/fix 2 DPRINTs as well.
2023-10-20 18:09:03 +02:00
Serge Gautherie
1fed9475cc [BOOTDATA] vfatfs.sys is packaged for xbox only (#5805)
Addendum to 14c3936 (0.4.15-dev-5090).
CORE-16373
2023-10-20 13:19:41 +02:00
Joachim Henze
ddd1d19b3f [TASKMGR] Get rid of cplusplus extern c (#5808)
The others in graphctrl.h and graph.h are being handled in the yet-uncommitted PR #5343.
2023-10-20 13:03:59 +02:00
Whindmar Saksit
ded91e310a [SHELL32] Enable Apply button when shortcut show mode is changed (#5807)
Basically this happens when the combobox selection changes.
2023-10-20 13:02:14 +02:00
Joachim Henze
63eaf2bd52 [TASKMGR] *.rc Deduplicate dynamic menu strings (#5772)
Some of the Menu-controls are just dummies in the RC,
because those controls are dynamically replaced at runtime
based on which tab/propsheet is active in taskmgr.
They are replaced by the IDS_MENU_* strings then.

Deduplicating them has many advantages:
1.) It shrinks binary size:
    master taskmgr.exe RosBEWin2.2.2 GCC8.4.0dbg  708.608 -> 696.832 bytes
2.) Translators don't get lured into translating dead stuff,
    assuming they translated the menu properly, while in fact they did not.
    This is *real*. Happened even to me multiple times already, although
    I am actually aware of the design.
3.) Some of them were offsync already between the dummy and the real thing.
4.) It reduces diff between en-US and other rc's.


* Aside of that improve alignment in some languages rcs in the "Shutdown"-menu-section,
* and improve a translation in de-DE, sq-AL, and zh-CN.
* [TASKMGR] id-ID.rc 2 accelerators in the same string is definitely wrong
* [TASKMGR] *.rc, make sure that warning is in all 30 langs, especially in en-US.rc
* [TASKMGR] for several translations add FIXME-comments regarding accelerator collisions
2023-10-19 10:19:20 +00:00
Hermès Bélusca-Maïto
171941ad18 [DESK] Add the current screensaver in the list if it isn't already present (#5766)
- Introduce AddScreenSaver[Item] helpers for adding screensavers in
  the list (either given by file path or by item structure).

- Rename "AddScreenSavers" to "EnumScreenSavers", and
  "ScreenSaverItem" type to "SCREEN_SAVER_ITEM".

- Ensure the stored "SCRNSAVE.EXE" value is NULL-terminated.

- Add the current screensaver, specified by the "SCRNSAVE.EXE" registry
  value, in the list if it isn't already present; otherwise select it
  in the list.

- Make the filename comparison case-insensitive.
2023-10-18 21:46:15 +02:00
Hermès Bélusca-Maïto
b3a25bcf8b [DESK] Reimplement InstallScreenSaverW to behave similarly to Windows' one (#5766)
CORE-6812 ; see also commit ff0951356 (r66688)

This function "just" changes the per-user SCRNSAVE.EXE registry value
to point to the new specified file, changes the SPI values and opens
the desk.cpl "Screensaver" property tab for letting the user change
the new selected screensaver properties.

In particular, it does *NOT* copy the specified file to System32 or
anything else (and doesn't verify that it is a valid PE executable).

Our previous implementation did none of that, and was also relying on
some private setupapi functions.

We now behave closer to Windows' desk.cpl.

Additionally:

- ReactOS-specific feature (compile-time define) disabled by default:
  Verify that the specified file actually exists, before changing
  the screensaver.
- Use NDEBUG, disabling DPRINT by default;
- Improve InstallScreenSaver[A,W] spec entries;
- Remove NUM_APPLETS define and use _countof() instead.
2023-10-18 21:45:39 +02:00
Hermès Bélusca-Maïto
fd1e5d53a5 [DESK] Cleanup some functions. 2023-10-18 21:30:10 +02:00
Stanislav Motylkov
0af84ce12d [NVNET] Remove NdisEqualMemory hack by linking with memcmp library
Fix suggested by Hermès Bélusca-Maïto. CORE-15872
2023-10-18 20:18:02 +03:00
Dmitry Borisov
59d8a77df6 [DC21X4] Add driver for DECchip 21x4-compatible network adapters (#5614)
These adapters were common in DEC Alpha boxes and they are really rare
nowadays. The 21140 chip is emulated in Connectix / Microsoft Virtual PC
and Hyper-V Gen 1 VM.

This is an experimental driver, not yet tested on real hardware.

CORE-8724
2023-10-18 20:12:36 +03:00
Timo Kreuzer
a8e8add0c0 [KERNEL32] Export more Vista functions 2023-10-18 15:55:41 +03:00
Timo Kreuzer
e0545dab15 [CMAKE] Improve configure script to work with newer CMake versions (#5742)
This change allows to properly pass parameters to newer CMake versions. Currently the script passes "VSSolution" and similar on to CMake, which are ignored, but newer CMake will complain. Allows to configure a VSSolution with CMake 3.27.4.
2023-10-17 13:17:35 +03:00
Timo Kreuzer
d9cb169920 [XDK] Fix / improve some definitions 2023-10-17 13:02:30 +03:00
Timo Kreuzer
7b38f80119 [STLPORT] Make stl thread-safe
Define _STLP_THREADS to make stl thread safe.
Also remove defined(__BUILDING_STLPORT) from the preprocessor conditions for which STLPInterlockedExchangePointer is defined, because that function is used in _threads.h, which can get included by apps using the stl through stl headers.
2023-10-17 13:01:24 +03:00
Katayama Hirofumi MZ
97e53c6963 [MSPAINT] Implement mouse middle button dragging (#5804)
- Handle WM_MBUTTONDOWN and
  WM_MBUTTONUP messages.
- Implement dragging by mouse middle button.
- Add IDC_HANDDRAG cursor resource.
CORE-19094
2023-10-17 15:58:34 +09:00
Timo Kreuzer
40d444919e [SDK] Move definition of MyInt128 into stubs.h 2023-10-17 09:41:18 +03:00
Timo Kreuzer
a27b8009e0 [SDK] Do not include windef.h into stubs.h
This prevents pulling in function declarations that are incompatible with the generated stubs.
2023-10-17 09:41:18 +03:00
Timo Kreuzer
3b7c7d8e68 [CMAKE] Don't use precompiled headers for autogenerated stub files 2023-10-17 09:41:18 +03:00
Katayama Hirofumi MZ
f49919ce5d [MSPAINT] Simplify canvas mouse message handling (#5803)
- Unify some mouse message handlers of
  CCanvasWindow.
- Add CCanvasWindow::m_nMouseDownMsg 
  member.
CORE-19094
2023-10-17 13:48:19 +09:00
Katayama Hirofumi MZ
8f1eb03ad2 [MSPAINT] Improve Zoom tool (#5798)
- Delete global zoomTo function.
- Add CCanvasWindow::zoomTo and
  CCanvasWindow::getNewZoomRect functions.
- Rename CCanvasWindow::updateScrollInfo as
  CCanvasWindow::updateScrollRange.
- Rename CCanvasWindow::resetScrollPos as
  CCanvasWindow::updateScrollPos.
- Draw the proper zoom rectangle on mouse move.
- Revert the active tool on click when the tool
  was Zoom.
CORE-19094
2023-10-17 07:25:50 +09:00
Egor Ananyin
e2d3aa7f4a [NTUSER] Remove a wrong check in MENU_MouseMove (#5736)
This check doesn't seem to be correct in modern ReactOS. Furthermore, it
actually hadn't been working for a long time until it was uncovered by
the recent system menu changes.

Reverts a hack introduced in 17a315285 (r72517), fixes CORE-19170.
The initial bug described in CORE-2338 is not observed.
2023-10-16 19:10:52 +03:00
Serge Gautherie
13a145b6d8 [USERENV] SetUserEnvironmentVariable(): Remove use of uninit' ShortName
Addendum to 96fe018 (r72066).
2023-10-16 19:02:27 +03:00
Katayama Hirofumi MZ
8669679499 [ATL][ATL_APITEST] Add some missing CRect methods (#5800)
- Strengthen "atltest.h".
- Strengthen atl_apitest:atltypes testcase.
- Implement some missing CRect methods.
2023-10-16 21:57:57 +09:00
Katayama Hirofumi MZ
d955b9321b [ATL] s/throw()/noexcept/ (#5799)
Mechanically replace throw() with noexcept.
2023-10-16 15:40:17 +09:00
Katayama Hirofumi MZ
fd1e158480 [MSPAINT] Calculate intersection to reduce bits transfer (#5795)
Drawing lines smoothly on big image.
- In CCanvasWindow::DoDraw, calculate the
  intersection to reduce bits transfer.
- Improve SmoothDrawTool in handling Shift key.
CORE-19094, CORE-19237
2023-10-16 09:09:40 +09:00
Hermès Bélusca-Maïto
5c2ec83fa7 [USETUP] Decouple bootloader install choice page from its actual installation (#5786)
This allows to move this choice sooner in the process, thus having all
the user key presses at first, then all the actual installation going
without any key presses needed anymore... (that is, unless you wanted
to install the bootloader on a removable device. Then it will prompt
you there!)

- Additional "cosmetic"/future-proof changes: Rename all instances
  of "floppy" in the bootloader install variables to "RemovableDisk"
  because it would be great to have this install choice later.

- Layout adjustments in the translated bootloader pages.

- Skip bootloader installation on upgrades. The idea here is that if
  we were able to find a ReactOS installation to upgrade, this means
  we were able to find a valid bootloader + boot entry.
  See also PR #5633.

  This logic may be slightly improved in the future to detect whether
  the underlying bootloader is FreeLdr and if so, only update its files.
  But this is for the future.
2023-10-14 16:29:43 +02:00
Katayama Hirofumi MZ
1c4bf2d702 [MSPAINT] Don't include useless <mapicode.h>
CORE-19094
2023-10-13 18:07:55 +09:00
Katayama Hirofumi MZ
1183e797b4 [MSPAINT] Reset scroll position in some situations (#5789)
In some situations, the scroll position should be reset.
- Add CCanvasWindow::resetScrollPos method.
- Reset the scroll position on loading a file.
- Reset the scroll position on mirroring/rotating
  the image.
CORE-19094
2023-10-12 22:59:17 +09:00
Katayama Hirofumi MZ
9a51c8e6c6 [MSPAINT][NOTEPAD][REGEDIT] Don't use CRTDBG for these apps (#5788)
Don't include <crtdbg.h>.
Don't use _CrtSetDbgFlag.
2023-10-12 22:53:02 +09:00
Katayama Hirofumi MZ
70d5c864bc [MSPAINT] Do type-cast (float) for xDpi and yDpi
CORE-19094
2023-10-12 19:43:29 +09:00
Katayama Hirofumi MZ
409df2355e [MSPAINT] Do type-cast (BYTE) for lfItalic and lfUnderline
CORE-19094
2023-10-12 19:38:41 +09:00
Katayama Hirofumi MZ
4306e261ee [MSPAINT] Do type-cast (BOOL) for TB_ISBUTTONCHECKED return
CORE-19094
2023-10-12 19:31:22 +09:00
Katayama Hirofumi MZ
bc28675a44 [MSPAINT] s/WINBOOL/BOOL/
CORE-19094
2023-10-12 19:13:20 +09:00
Justin Miller
ff3dadf89d [FREELDR] Enable UEFI boot for x86 and amd64 (#5267)
Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>

- Allow to boot NT kernel on UEFI systems with our 2 primary supported architectures
- Implement remaining code needed to pass execution to x86 and amd64 kernels

CORE-11954
2023-10-11 12:45:08 -07:00
Oleg Dubinskiy
a6b281c228 [KS] KsRead/WriteFile: finish IRP initialization and properly setup I/O stack location for it (#5784)
- Initialize the rest of IRP data which is not initialized by IoBuildSynchronousFsdRequest.
- Setup an IO_STACK_LOCATION structure for the IRP before calling the driver's read/write routine.
- Do this for both KsReadFile and KsWriteFile functions in our Kernel Streaming driver (ks.sys).
This fixes several problems when calling these functions from outside, so now they are working correctly, as expected.
Discovered during my audio investigations.
CORE-19232
2023-10-10 13:30:00 -07:00
Alexey Strukov
8451230753 [DEVMGR] Allow to copy text from Details page of device properties (#5775)
In driver properties, in details tab, add a "Copy" popup menu for listview.
This will allow to copy driver's information to buffer.
2023-10-10 21:22:54 +02:00
Katayama Hirofumi MZ
62eeb158a5 [MSPAINT] Improve Zoom tool (#5781)
- Delete CCanvasWindow::drawZoomFrame.
- Invalidate the canvas on mouse move when
  the active tool is Zoom tool.
- Add ZoomTool::OnDrawOverlayOnCanvas to
  draw the zoom rectangle without flickering.
- Improve the zoom trackbar position.
- Display the zoom rate on changing the value
  of the zoom trackbar.
- Reverse the direction of the zoom trackbar.
- Don't draw the focus rectangle.
CORE-19215, CORE-19216
2023-10-10 10:59:29 +09:00
Katayama Hirofumi MZ
0c164f081a [MSPAINT] Check out of image in updating status bar (#5779)
Check out of the image by using ::PtInRect and CCanvasWindow::GetImageRect.
If out, then don't show the status bar text.
CORE-19219
2023-10-09 08:39:31 +09:00
Katayama Hirofumi MZ
611d89eb8b [MSPAINT] Add border width to tool box (#5780)
Make tool box pixel-perfect. Add two border widths to the tool box.
CORE-19217
2023-10-09 08:37:31 +09:00
Timo Kreuzer
63aef3e1fc [T2EMBED] Improve spec file
- Only export stdcall annotated functions on x86
- Turn annotated stubs / forwarders into normal exports
- Note: MSVC removes decorated exports / forwarders, as soon as the undecorated version is exported, even when _declspec(dllexport) is used, no idea how to fix that.
2023-10-09 02:34:30 +03:00
Katayama Hirofumi MZ
8d8f4d328c [MSPAINT] Zoom tool shouldn't use undo buffer (#5778)
Remove PushImageForUndo call in Zoom tool. CORE-19214
2023-10-09 08:07:02 +09:00
Hermès Bélusca-Maïto
11b706429c [WSHTCPIP] Remove unneeded headers + Fix bugs.
- Mismatch NTSTATUS/DWORD for win32 errors;
- Close handle returned from openTcpFile() with closeTcpFile().
2023-10-08 17:11:26 +02:00
Hermès Bélusca-Maïto
9021a14f4a [NDK] Fix weird "ntstatus.s" statement (#5771)
Spotted by Serge Gautherie.
2023-10-08 17:11:25 +02:00
Joachim Henze
42c93e3cbb [TASKMGR] *.rc: Fix accelerator collisions &Priority <-> &Properties (#5758)
We had collisions in many languages.
For most languages (which are derived from en-US) we should use
&Priority
P&roperties

We introduced the collisions during 0.4.15-dev'ing when
MENUITEM ID_PROCESS_PAGE_PROPERTIES
and
MENUITEM ID_PROCESS_PAGE_OPENFILELOCATION
were added.


We verified Win7-en and Win2k3-en to behave as proposed in this PR (R for properties, P for priority).
But *french* Windows (I believe Hermes picture was from WinVista-fr or Win7-fr or Win10-fr maybe) does it differently.

the existing de-DE also has been double-checked to exactly match MS with the accelerators in that menu.
2023-10-07 23:03:47 +00:00
Hermès Bélusca-Maïto
ce08851758 [DESK] Use MultiByteToWideChar instead of the private pSetupMultiByteToUnicode function (#5765)
This avoids having desk.cpl depend on a private function that may change
or disappear, and increase the probability of being able to use that CPL
across different Windows versions.

(Note: this pSetupMultiByteToUnicode was one of those whose name changed
between Windows 2000 and XP+)
2023-10-07 22:17:58 +02:00
Hermès Bélusca-Maïto
e4608f7450 [DESK][SHELLBTRFS] Fix typo in WIN32_NO_STATUS 2023-10-07 22:15:12 +02:00
Hermès Bélusca-Maïto
d0b43a399f [NETID] Simplify IsUserAdmin() helper implementation (#5763)
Addendum to commit 8c4b0c914.

Base ourselves on pSetupIsUserAdmin() and other similar functions in our
codebase. Note that what we are actually interested here, is whether the
current thread runs with Administrator privileges.

(As noticed by contributor 'whindsaks', "Not only is this code simpler,
it now will correctly handle deny-only SIDs in the token!")
2023-10-07 21:52:36 +02:00
Timo Kreuzer
e685b25e35 [NTOS:MM/x64] Temporarily release AddressCreationLock in MmCreateVirtualMappingUnsafeEx
This is a hack, because the kernel mode path can incur a recursive page fault with the AddressCreationLock acquired, which would lead to a recursive acquisition, once we do proper locking in MmAccessFault.
To properly fix this the PDE must be made valid, similar to the user mode path, but that is not that simple...
2023-10-07 10:58:30 +03:00
Oleg Dubinskiy
d96b3cd45c [KS] Fix bug in KsStreamIo (#4663)
Properly set output buffer length in IO Stack Location of the current IRP, since it is passed to KsProbeStreamIrp when calling KsStreamIo, so it fails if the length isn't set properly.

Don't set an input buffer length and the buffer itself, since it isn't passed anywhere, so setting it makes no sense. Moreover, MSDN says that for IOCTL_KS_READ/WRITE_STREAM, only output buffer (and its length) is needed to be set, but not an input one. So it indeed is more correct.

It fixes buffer overflow in KsProbeStreamIrp when attempting to perform the streaming via KsStreamIo. I discovered this bug during my audio refactoring from PR #4660.
2023-10-06 12:36:09 +02:00
Hermès Bélusca-Maïto
2a5fd78f1b [APPHELP_APITEST] Fix build, addendum to commit a8755711b 2023-10-05 21:32:38 +02:00
Hermès Bélusca-Maïto
a8755711b9 [APPHELP_APITEST] Deduplicate the IsUserAdmin() helper. 2023-10-05 20:58:57 +02:00
Hermès Bélusca-Maïto
f1cff6ef27 [DESK] Remove deprecated code.
This mostly reverts commit 221f21c62 (r29328), that was a hack for
building with MSVC. We can nowadays correctly link with the shell32
SHCreatePropSheetExtArrayEx() export.
2023-10-05 20:58:28 +02:00
Katayama Hirofumi MZ
1a90009bb9 [MSPAINT] Update scroll info on loading file (#5761)
The scroll info was not updated when the file is loading.
- Rename CCanvasWindow::Update as CCanvasWindow::updateScrollInfo.
- Update scroll info on ImageModel::NotifyImageChanged.
- Improve ImageModel::ClearHistory.
CORE-19094
2023-10-05 20:01:41 +09:00
Katayama Hirofumi MZ
3579ea7888 [MSPAINT] Fix assertion failure on text tool (#5762)
Kill the assertion failure on choosing text tool.
Check whether textEditWindow is not null by using IsWindowVisible.
CORE-19094
2023-10-05 19:51:36 +09:00
George Bișoc
d72025649b [NTOS:SE] Mute the access denied DPRINTs
They can be spammy. Also clarify these debug prints, because some people
think that "failed to grant access rights" means there's something wrong
in the core access check functions.
2023-10-04 18:04:30 +02:00
George Bișoc
09bfd96f3b [NTOS:SE] HACK: Temporarily add the Local group SID to the system token
Temporarily add the local group to the system token so that Virtualbox
GA services can properly set up network drives for shared folders.

What happens is that a security descriptor has a DACL with only one ACE
that grants access to Local SID (presumably coming from Vbox?)
but the client token is that of the service which is a SYSTEM token.
Perhaps we are not impersonating the right user or whatever else.

This is only a temporary placebo, until a proper solution is found.

CORE-18250
2023-10-04 18:04:30 +02:00
George Bișoc
fefb1b7745 [NTDLL_APITEST] Write NtAccessCheck testcase that tests for empty generic mapping scenario
See b79aadd50bb7d5d6f08532284941c0334514c477 for further information.
2023-10-04 18:04:29 +02:00
George Bișoc
4b4638dc55 [NTOS:SE] HACK: Temporarily grant access to the client if empty generic mapping was passed
Certain apps such as AIM installer passes an empty generic mapping (this can
be understood with their generic masks set to 0) and our code tries to map
the access right from an ACE with the mapping provided by AccessCheck.

This can lead to a bug where we would not be able to decode the generic right
from an ACE as we need a proper generic mapping in order to do so. A mask
right that is not decoded it cannot be used to mask out the remaining rights,
further resulting into a denied access right.

What Windows does instead is they are mapping the ACE's rights in another place,
presumably when setting security data to an object, and they are using the
generic mapping passed by the kernel.

What we can do for the time being is to temporarily grant access to the client,
but only if they are an administrator.

CORE-18576
2023-10-04 18:04:29 +02:00
George Bișoc
95c104f29a [TCPIP] Setup a security descriptor for the IP and TCP device objects
Grant access to such objects to system, admins and network services.
2023-10-04 18:04:17 +02:00
Ratin Gao
be5c889cdf [NTDLL:LDR] SAL improvements and fixes
- Convert some notations to SAL2
- "Name" parameter in LdrGetProcedureAddress/LdrpGetProcedureAddress should be optional
- "DllCharacteristics" parameter in LdrGetDllHandle should be optional
2023-10-04 12:26:18 +03:00
Joachim Henze
46b4b5581d [TASKMGR] Favor _countof(), no functional change intended (#5757)
Taskmgr used a mixture: Sometimes _countof(), sometimes ARRAYSIZE()
and sometimes it calculated the count plain by sizeof(var)/sizeof(TYPE).
Harmonize everywhere to _countof() as it is the shortest solution.

Fix some formatting sins, like placing comments before else-statement.
Shorten the length of some very long line
intentionally *without introducing additional linebreaks* !

Shorten vertical length of some functions to increase their chance to
fit on the screen without scrolling.

Fix wrong indentation level in TaskManagerWndProc().

*.rc: Remove superfluous and redundant comment in all langs

No functional change intended.
2023-10-03 21:00:10 +02:00
Timo Kreuzer
410b1030c0 [NTOS:KE/x64] Implement detection of more KF_* feature flags
- Detect KF_SSSE3, KF_SSE4_1, KF_SSE4_2, KF_RDRAND, KF_BRANCH, KF_SLAT, KF_GENUINE_INTEL, KF_AUTHENTICAMD, KF_ACNT2, KF_SMEP, KF_SMAP, KF_RDWRFSGSBASE, KF_XSAVEOPT, KF_XSAVES, KF_HUGEPAGE, KF_RDTSCP
2023-10-03 19:45:44 +03:00
Timo Kreuzer
1a7ab2fe68 [NTOS:KE/x64] Use structures for CPUID 2023-10-03 19:45:44 +03:00
Timo Kreuzer
6048ebeff9 [SDK] Add CPUID and MSR definitions for x86/x64
- Import definitions from edk2 (see https://github.com/tianocore/edk2/tree/master/MdePkg/Include/Register)
- Add additional unions as well as AMD SVM CPUID
2023-10-03 19:45:44 +03:00
Timo Kreuzer
70f6ed8ee3 [NTOS:KE/x64] Improve CPU feature detection
- Use 64 bit feature flags (with a hack in the PRCB)
- Improve setting up SharedUserData->ProcessorFeatures
2023-10-03 19:45:44 +03:00
Timo Kreuzer
47c1dcd023 [NDK] Update kernel feature bits constants
- Move them into architecture specific headers.
- Add missing constants based on https://www.geoffchappell.com/studies/windows/km/ntoskrnl/structs/kprcb/featurebits.htm
- Yes, they are 64 bits
2023-10-03 19:45:44 +03:00
Timo Kreuzer
b66441d581 [XDK] Add missing PF_* processor feature definitions 2023-10-03 19:45:44 +03:00
George Bișoc
50f367fa58 [NTOS:CM] Use COMPUTE_HASH_CHAR to compute the conv hash key
We have a dedicated macro definition for that so just use it.
2023-10-03 11:01:21 +02:00
Whindmar Saksit
34066e475a GetDetailsOf does not support column flags (#5755)
GetDetailsOf does not support the column flags used by CompareIDs.
As a side effect, also fixes LPARAM to UINT truncation on 64-bit.
2023-10-03 10:43:44 +02:00
Joachim Henze
6528ab8fcb [TASKMGR] de-DE.rc Update part 3
I spotted yet another flip:
translation of IDS_TAB_PFDELTA and IDS_TAB_VMSIZE were flipped.

I spotted that by toggling all columns off entirely
in the View-Options dialog where the columns can be selected
and then added only one column at a time. I did that for all options.

I do recommend translators of other langs to do the same test,
I was shocked about the amount of bugs I spotted for german.
And it is very subtle / easy to miss, if you enable/disable multiple columns
together!

Let's call it a day now!
2023-10-03 06:31:04 +02:00
Joachim Henze
65ce20896a [TASKMGR] *.rc Strip unused IDD_DEBUG_CHANNELS_DIALOG
This is an addendum to 0.4.15-dev-413-g ed7196d964

binary size shrinks slightly although that dlg was unused:
taskmgr.exe RosBEWin2.2.2 GCC8.4.0dbg  715.264 -> 708.608
2023-10-03 03:50:41 +02:00
Joachim Henze
142c35fcce [TASKMGR] de-DE.rc Update
GRAPH == 'Anzeige'. Addendum to last commit
2023-10-03 02:47:10 +02:00
Joachim Henze
e15d68ba5d [TASKMGR] de-DE German Update & bug-fixes
This fixes several issues:
- add a few missing translations, e.g. ID_PROCESS_PAGE_PROPERTIES & ID_PROCESS_PAGE_OPENFILELOCATION
- IDS_TAB_PEAKMEMUSAGE translation was flipped with IDS_TAB_MEMDELTA
- IDC_MEM_USAGE_FRAME had text truncation, fix that by structurally switching to "Speicher"
- waste less space for the listview headers in the Processes tab so user can display more columns conveniently without the headers unnecessarily being crippled to "..."
- Sync some controls sizes back to en-US in the performance tab
- Translation for ID_VIEW_CPUHISTORY_ONEGRAPHALL and ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU was swapped accidentally
- Strip comment lines in the end, which were outdated anyway
- avoid monsters that not even a german person can read like "Auslagerungsdateiauslastungs-Verlaufsanzeige" which is like "Donaudampfschifffahrtselektrizitätenhauptbetriebswerkbauunterbeamtengesellschaft"
2023-10-03 02:05:28 +02:00
Carl J. Bialorucki
3e46a8673d [EXPLORER][COMCTL32] Fix balloon tooltips and system pager alerts (#5559)
- [EXPLORER] Set maximum balloon width for notification area
- [COMCTL32] Fix balloon tooltip shape

- Limit balloon tooltips from extending past the edges of the monitor, not the edges of the work area.
- Instead of simply repositioning the main rectangle when the balloon is too far towards one edge of the screen,
  try flipping the balloon the other way. This is the same behavior as Windows Server 2003.
- Tweak some values used to draw the balloon tooltips to more closely follow the Windows balloon tooltip style.
- Removing trailing whitespace.
- While the new changes are guarded, consider cancelling our Wine sync for common controls.
  Our common controls are responsible for many graphical issues and lack of features throughout ReactOS.

CORE-19109
2023-10-03 01:08:45 +03:00
Stanislav Motylkov
f53be82158 [REACTOS] Revert badly formatted commits
This reverts commits ab1868c7bf and 1aa76275ac.
2023-10-03 01:00:07 +03:00
Carl J. Bialorucki
f744bb2994 [BROWSEUI] More settings and window refresh (#5584)
Adds the option to set the address edit box to use the display name or the full path. Also refreshes the window title and edit box in all open explorer windows when changing these settings using the folder options dialog.

## PROPOSED CHANGES ##
- Create a new CabinetStateSettings type that inherits from the CABINETSTATE type. This allows us to add additional cabinet state settings not exposed in the CABINETSTATE type as well as adding a Load() method to easily populate the cabinet state settings.

- Add a global cabinet state settings object. While most settings in browseui are stored independently in each shellbrowser window, cabinet state settings are global and apply to every shellbrowser window. This can be confirmed on Windows Server 2003 and Windows 7.

- When receiving the WM_SETTINGCHANGE window message from the folder options dialog, refresh the title of the window and the text in the address edit box. This is the same behavior as Windows Server 2003 and Windows 7.
Add a DWORD registry value to HKCU\...\Explorer\CabinetState\FullPathAddress to allow users to toggle this setting on or off in our folder options.

CORE-9277
2023-10-02 22:43:00 +02:00
Carl J. Bialorucki
1aa76275ac Fix balloon tooltip shape 2023-10-02 22:39:10 +02:00
Carl J. Bialorucki
ab1868c7bf Set maximum balloon width for notification area 2023-10-02 22:39:10 +02:00
Sarthak Roy
4ba8af9cae [CALC] Use pragma once for calc.h (#5754)
It's simpler and only needs to be included once at the beginning of the
header file. It generates an unique identifier for the file automatically,
so maintainers wouldn't need to choose unique names for the macros.
It will be helpful if any future refactoring takes place.

Signed-off-by: Sarthak Roy <sarthakroy2002@gmail.com>
2023-10-02 00:58:32 +03:00
George Bișoc
dd54cd32cf [NTDLL_WINETEST] Enable registry tests for KeyCachedInformation back 2023-10-01 20:06:03 +02:00
George Bișoc
c0ea1f96ef [NTOS:CM][DOCUMENTATION] Provide documentation for newly added functions 2023-10-01 20:06:03 +02:00
George Bișoc
f4de5ceb9e [NTOS:CM] Implement cache lookup and cleanup subkey information for cache consistency
During an open or create procedure of a registry key, the registry parser grabs
a key control block (KCB) from the parser object and uses its information to do the
necessary work in order to obtain a pointer to the newly created or opened registry key.

However, the registry parsers faces several issues. First, we don't do subkey cache cleaning
information against gathered KCBs so whenever we do a registry parse we end up with KCBs
that have cache inconsistencies. Moreover we don't do any locking of whatever KCB we
are grabing during a parse procedure.

=== PROPOSED CHANGES ===

* Implement CmpComputeHashValue and CmpLookInCache functions. With CmpComputeHashValue we can
compute the convkey hashes of each subkey in the path name of a key so we can lock them
with CmpBuildAndLockKcbArray. CmpLookInCache is a function that searches for the suitable
KCB in the cache. The factors that determine if a KCB is "suitable" are:

-- the currently found KCB in the hash list has the same levels as that of the
given KCB from the parse object;

-- The key names from the computed hash values match with the block name of
the KCB;

-- The currently found KCB is not deleted.

The KCB will be changed if the key path name points to a partial match name in
the cache. The KCB from the parse object will be used if we have a full match
of remaining levels.

* Add missing CMP_LOCK_HASHES_FOR_KCB flags on CmpCreateKeyControlBlock calls
that create KCBs during a parse procedure. Such lock has to be preserved until
we're done with the registry parsing.

* On CmpDoCreateChild, preserve the exclusive lock of the KCB when we are
enlisting the key body.

* On CmpDoCreate, make sure that the passed parent KCB is locked exclusively and
lock the hiver flusher as we don't want the flusher to kick in during a key
creation on the given hive. Cleanup the subkey info when we're creating a key
object. Also implement missing cleanup path codes. Furthermore, avoid key
object creation if the parent KCB is protected with a read-only switch.

* Soft rewrite the CmpDoOpen function, namely how we manage a direct open vs
create KCB on open scenario. When a KCB is found in cache avoid touching
the key node. If the symbolic link has been resolved (aka found) then lock
exclusively the symbolic KCB. Otherwise just give the cached KCB to the caller.

If it were for the caller to request a KCB creation, we must check the passed
KCB from the parser object is locked exclusively, unlike on the case above
the caller doesn't want to create a KCB because there's already one in the cache.
We don't want anybody to touch our KCB while we are still toying with it during
its birth. Furthermore, enlist the key body but mind the kind of lock it's been
used.

* On CmpCreateLinkNode, avoid creating a key object if the parent KCB is protected
with a read-only switch. In addition, add missing hive flusher locks for both
the target hive and its child. Cleanup the subkey information of the KCB when
creating a link node, this ensures our cached KCB data remains consistent.

* Do a direct open on CmpParseKey if no remaining subkey levels have been found
during hash computation and cache lookup, in this case the given KCB is the
block that points to the exact key. This happens when for example someone tried
to call RegOpenKeyExW but submitting NULL to the lpSubKey argument parameter.

CORE-10581
ROSTESTS-198
2023-10-01 20:06:02 +02:00
George Bișoc
8cb56e77a6 [NTOS:CM] Do not call CmpSecurityMethod when assigning a security descriptor
CmpSecurityMethod is a method used by the Object Manager and called by this
subsystem whenever a security operation has to be done against a key object.

As CmpSecurityMethod is a specific OB construct we should not make any direct
call attempts to CmpSecurityMethod, only OB is responsible for that. This fixes
a deadlock where CmpSecurityMethod acquires a push lock for exclusive access
even though such lock is already acquired by the same calling thread in
CmpDoCreateChild.
2023-10-01 20:06:02 +02:00
George Bișoc
7fd6f86803 [NTOS:CM] Do not acquire a KCB lock twice when deleting a key object
This prevents a deadlock in DelistKeyBodyFromKCB when we delete a key
object because of an access check failure during a open procedure of a
registry key, as we are already holding a lock against the target KCB of
the key body.
2023-10-01 20:06:02 +02:00
George Bișoc
697a52aa33 [NTOS:CM] Do not acquire the lock twice when the Object Manager calls CmpSecurityMethod
Whenever a security request is invoked into a key object, such as when requesting
information from its security descriptor, the Object Manager will execute
the CmpSecurityMethod method to do the job.

The problem is that CmpSecurityMethod is not aware if the key control block
of the key body already has a lock acquired which means the function will attempt
to acquire a lock again, leading to a deadlock. This happens if the same
calling thread locks the KCB but it also wants to acquire security information
with ObCheckObjectAccess in CmpDoOpen.

Windows has a hack in CmpSecurityMethod where the passed KCB pointer is ORed
with a bitfield mask to avoid locking in all cases. This is ugly because it negates
every thread to acquire a lock if at least one has it.
2023-10-01 20:06:02 +02:00
George Bișoc
08fcf0c58b [NTOS:CM] Implement locking/unlocking of KCBs in an array
The CmpUnLockKcbArray, CmpLockKcbArray and CmpBuildAndLockKcbArray routines
help us to lock KCBs within array so that information remains consistent when
we are doing a cache lookup during a parse procedure of the registry database.
2023-10-01 20:06:01 +02:00
George Bișoc
c6230ba255 [NTOS:CM] Add KCB array lock function prototypes & Other Stuff
Implement CmpBuildAndLockKcbArray and CmpUnLockKcbArray prototypes, we'll gonna need these
to do the locking/unlocking of KCBs stacked up in an array. In addition implement some CM
constructs specifically for cache lookup implementation (more at documentation remarks).

=== DOCUMENTATION REMARKS ===

CMP_SUBKEY_LEVELS_DEPTH_LIMIT -- This is the limit of up to 32 subkey levels
that the registry can permit. This is used in CmpComputeHashValue to ensure
that we don't compute more than the limit of subkeys we're allowed to.

CMP_KCBS_IN_ARRAY_LIMIT -- This is equal to CMP_SUBKEY_LEVELS_DEPTH_LIMIT
plus the addition by 2. This construct is used as a limit of KCB elements
the array can hold. 2 serves as an additional space for the array (one for
the root object and another one as extra space so we don't blow up the stack
array).

CMP_LOCK_KCB_ARRAY_EXCLUSIVE & CMP_LOCK_KCB_ARRAY_SHARED -- These flags are used exclusively
for CmpBuildAndLockKcbArray and CmpLockKcbArray. Their meaning are obvious.

CM_HASH_CACHE_STACK -- A structure used to store the hashes of KCBs for locking. It is named
"stack" because the way we store the hashes of KCBs is within an auxilliary "outer stack array".
2023-10-01 20:06:01 +02:00
George Bișoc
8a335a3141 [NTOS:CM] Implement the shared lock macro for use
CmpAcquireKcbLockSharedByKey can come in handy for use to lock KCBs by their convkey with a shared lock, specifically we would need this for cache lookup stuff.
2023-10-01 20:06:00 +02:00
George Bișoc
26fe3616fe [NTOS:CM] Implement COMPUTE_HASH_CHAR macro definition
Wrap the hash computation formula in a macro so that we don't have to copy
the logic over the places again and again.
2023-10-01 20:06:00 +02:00
George Bișoc
a4213d491d [NTOS:CM] Add surrounding parentheses to GET_HASH_INDEX definition 2023-10-01 20:05:57 +02:00
Timo Kreuzer
0e68e27ff6 [WINSPOOL] Add a number of missing NULL checks. 2023-10-01 13:05:51 +03:00
Timo Kreuzer
02df49ebd8 [WINSPOOL] Properly copy the DEVMODE in IntFixUpDevModeNames
Otherwise the size isn't set up correctly, leading to a crash.
Fixes crash in comdl32_winetest printdlg.
2023-10-01 13:05:51 +03:00
Joachim Henze
8c76870639 [NTOS:MM] Fix missing \n in unimplemented codepath DPRINT
We can hit that unimplemented code-path-line in NtQuerySection()
when browsing youtube.com with Chromium 49.
2023-09-30 19:06:30 +02:00
Katayama Hirofumi MZ
945ee4b2a4 [MSPAINT] Larger/smaller Rubber/AirBrush on Ctrl+Plus/Minus (#5740)
- Enable changing rubber/airbrush thickness by Ctrl+Plus / Ctrl+Minus
  key combination in TOOL_AIRBRUSH and TOOL_RUBBER.
CORE-19094
2023-09-28 21:54:32 +09:00
Katayama Hirofumi MZ
8a4787b384 [MSPAINT] Larger/smaller brush nib on Ctrl+Plus/Minus (#5739)
- Introduce the concept of "brush width" to the
  tools model.
- Enable changing the brush width by Ctrl+Plus/Minus
  key combination in TOOL_BRUSH.
- Re-define brush styles.
CORE-19094
2023-09-28 21:30:34 +09:00
Serge Gautherie
c84b5007d0 [NTOS:CM] Simplify CmpDelayAllocBucketLock code a bit (#5729)
- Remove duplicate CmpDelayAllocBucketLock definition.
- Remove an else.
2023-09-28 11:39:13 +02:00
Katayama Hirofumi MZ
f2a012240f [MSPAINT] Larger/smaller pen nib on Ctrl+Plus/Minus (#5738)
- Introduce the concept of pen width (not line width) to the tools model.
- Enable changing pen/line width by Ctrl+Plus/Minus key combination in TOOL_PEN,
  TOOL_LINE, TOOL_BEZIER, TOOL_RECT, TOOL_SHAPE, TOO_ELLIPSE, and
  TOOL_RRECT tools.
CORE-19094
2023-09-28 16:32:36 +09:00
Katayama Hirofumi MZ
cbc63d876c [MSPAINT] "Selection Clone" and "Selection Brush" (#5734)
- Stamp the image of the selection when the user clicks on
  the selection while holding down the Ctrl key.
- Draw the image of the selection continuously when the user
  starts dragging the selection while holding down the Shift key.
CORE-19094
2023-09-28 07:34:25 +09:00
Timo Kreuzer
03283371c1 [NTOS/Mm] Fix SWAPENTRY bit-check in MmCreatePageFileMapping
Test for the highest bit, not for bit 3 / 7.
2023-09-28 01:19:47 +03:00
Joachim Henze
058b746bbe [SHELL32] *.rc: AGAIN! Use 1996 as birth year in IDD_ABOUT for consistency
We do use the birth year 1996 instead of 1998
within our msgina pictures already,
and also within the [SDK] for autogenerated file-info.

Since SHELL32 IDD_ABOUT is used by many applications it makes sense to harmonize with that.

Was done already during 0.4.15-dev for SHELL32, but we have to do it again,
since some recent translation PRs to match the en-US.rc again.
2023-09-27 22:23:31 +02:00
Joachim Henze
29c0e23fd4 [MAZESCR] Avoid (DLGPROC) cast, fix a typo (#5694)
May help a bit with x64.

Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
2023-09-27 17:37:44 +00:00
Joachim Henze
e69d2e8b89 [CMICONTROL] Fix MSVC 14.2 dbg x64 warning C4267 (#5696)
Can be observed on the buildbots:
2023-09-17T14:19:34.2051345Z [10663/14808] Building CXX object drivers\wdm\audio\drivers\CMIDriver\cmicontrol\CMakeFiles\cmicontrol.dir\main.cpp.obj
2023-09-17T14:19:34.2052611Z D:\a\reactos\reactos\src\drivers\wdm\audio\drivers\CMIDriver\cmicontrol\main.cpp(818): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
2023-09-27 17:34:32 +00:00
Serge Gautherie
9ca88bef80 [NTOS:MM] Fix 'eanbled' typo in a comment (#5728) 2023-09-27 17:31:42 +00:00
Timo Kreuzer
8227c5d380 [NTOS] Implement support for opting out of NX policy
Fixes crash in ntdll_winetest info on x64.
2023-09-26 18:04:19 +03:00
Timo Kreuzer
6133cc016d [CRT/x64] Fix a bug in __C_specific_handler
Fixes crash of compiler_apitest pseh
2023-09-26 18:02:21 +03:00
Timo Kreuzer
cf4aa7ea9d [LSASRV] Fix usage of self-relative security descriptor in LsarQuerySecurityObject 2023-09-26 18:01:45 +03:00
Timo Kreuzer
5127433416 [SAMSRV] Fix usage of self-relative security descriptor in SamrQuerySecurityObject
Fixes crash of netapi32_winetest access
2023-09-26 18:01:45 +03:00
Timo Kreuzer
df053d4e43 [RTL] Improve usage of absolte vs self-relative security descriptors
- RtlpQuerySecurityDescriptor: Change argument type of first parameter from PISECURITY_DESCRIPTOR to PSECURITY_DESCRIPTOR, since it handles both absolute and self-relative SDs.
- RtlMakeSelfRelativeSD: rename first parameter from AbsoluteSD to SecurityDescriptor, since it handles both absolute and self-relative SDs.
- SepGetGroupFromDescriptor/SepGetOwnerFromDescriptor/SepGetDaclFromDescriptor/SepGetSaclFromDescriptor: Change parameter type from PVOID to PSECURITY_DESCRIPTOR for clarity.
2023-09-26 18:01:45 +03:00
Katayama Hirofumi MZ
389d04650f [MSPAINT] Restrict drawing direction on Shift key (#5726)
- While holding down the Shift key, drawing lines with the
  pen/brush is limited to either of 8 directions (horizontal/vertical/diagonal).
- s/abs/labs/
CORE-19094
2023-09-26 22:47:23 +09:00
Katayama Hirofumi MZ
d1e9fe13de [SHELL32][SDK] Implement SHTestTokenPrivilegeW (#5725)
and modify shell32.spec.
2023-09-26 07:36:07 +09:00
Doug Lyons
1b3eed58ca [SHELL32] Fix for shlexec.cpp regressions (#5282)
fixes CORE-18967 'Taskbar toolbar - Right click > Open folder fails'
by restoring the code-path we removed with the guilty 
0.4.15-dev-3847-g /9b716539182864bc077e362febcda74da50287ed 

and add test_sei_lpIDList to shell32:ShellExecuteEx apitest test to protect
that functionality on future attempts to simplify.
2023-09-24 20:35:28 +00:00
Katayama Hirofumi MZ
cc6e444ceb [SHELL32][SDK] Implement SHInvokePrivilegedFunctionW (#5718)
Add it to <undocshell.h>. Modify shell32.spec.
2023-09-24 07:11:38 +09:00
Timo Kreuzer
ed06c06dcb [NTOS:CM] Fix lock leak
Triggered by low available pool memory during kmtest ExPools.
2023-09-23 18:34:00 +03:00
Andrew Dent
aa84645bcc [THEMES] Optimize png for Lautus style (#5712)
Lossless optimization of new png Start button in Lautus style, original by @Splitwirez (ed134bf2, #5540).
Slimmed 464 bytes, ~20% saving. This png is encoded as a grayscale+alpha, so should be tested.
2023-09-23 15:54:39 +03:00
Timo Kreuzer
88808bad8a [RPCRT4] Fix x64 assembly code
movaps is a 128 bit aligned move, we need a 64 bit unaligned move, so use movsd.
Fixes a crash in oleaut32_winetest tmarshal.
Also add a comment about the use of movd instead of movq.
2023-09-23 11:06:24 +03:00
Katayama Hirofumi MZ
ed9973f876 [MSPAINT] Introduce Ctrl+Plus / Ctrl+Minus (#5717)
- Add Ctrl+Plus and Ctrl+Minus accelerators.
- Add IDM_CTRL_PLUS and IDM_CTRL_MINUS
  commands.
- Stretch the selection area on IDM_CTRL_PLUS
  and IDM_CTRL_MINUS actions.
CORE-19094
2023-09-23 09:26:11 +09:00
Katayama Hirofumi MZ
bbb33a6ed5 [MSPAINT] Don't show error message twice (#5715)
- Reduce display of error message on IDM_EDITCOPYTO and IDM_EDITPASTEFROM.
- Introduce LockBitmap/UnlockBitmap mechanism for ImageModel and SelectionModel.
CORE-19181, CORE-19182
2023-09-22 10:48:13 +09:00
Katayama Hirofumi MZ
98050f9139 [MSPAINT] Don't copy bits on resizing (#5716)
- Fix the graphical glitches on resizing and moving toolbars.
- Add SWP_NOCOPYBITS flag on positioning controls on resizing of main window.
CORE-19137
2023-09-22 07:35:03 +09:00
Timo Kreuzer
4661bc006d [WIN32K] Prevent dereferencing NULL pointer
Initialize a window's ThreadListEntry as an empty list on creation and only remove the window from the list on destruction, when the entry is not an empty list. Previously the window creation could fail before the list entry was initialized and the window would get destroyed after that, resulting in a NULL pointer dereference.
2023-09-21 23:45:31 +03:00
Timo Kreuzer
41c99aa60a [KERNEL32] Fix RaiseException to correctly copy the passed in parameters as ULONG_PTR
Fixes C++ exception handling on x64.
2023-09-21 21:33:47 +03:00
Katayama Hirofumi MZ
4407e0aefa [SHELL32][SDK] Implement SHOpenEffectiveToken and SHGetUserSessionId (#5713)
- Implement SHOpenEffectiveToken and
  SHGetUserSessionId functions.
- Add them to <undocshell.h>.
2023-09-21 22:44:20 +09:00
Hermès Bélusca-Maïto
4bdfee8e8b [NTOS:EX] Initialize ExpResourceTimeoutCount also via the "Session Manager/ResourceTimeoutCount" registry value (#4089)
For more details, see
http://systemmanager.ru/win2k_regestry.en/29859.htm
https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/102985#ResourceTimeoutCount_REG_DWORD
2023-09-21 13:33:28 +02:00
Hermès Bélusca-Maïto
56417bfb93 [RTL] Satisfy the RtlpTimeoutDisable condition when waiting for critical sections (#4089) 2023-09-21 13:33:28 +02:00
Hermès Bélusca-Maïto
dff55c9d33 [NTDLL][RTL] Move RtlpTimeoutDisable definition to the RTL (#4089) 2023-09-21 13:33:27 +02:00
Hermès Bélusca-Maïto
6f89a48349 [NTDLL:LDR] Fix process LoadConfig CS timeout conversion from ms to 100ns units (#4089)
For more details, see
https://forums.codeguru.com/showthread.php?370731-EnterCriticalSection-locking&p=1302399#post1302399
2023-09-21 13:33:26 +02:00
Hermès Bélusca-Maïto
b5c75ce506 [NTOS:EX] Minor header formatting. 2023-09-21 13:33:25 +02:00
Hermès Bélusca-Maïto
903a3dc622 [NTDLL][RTL] Fix english typo in (internal) function name. 2023-09-21 13:33:18 +02:00
Oleg Dubinskiy
f4d7cccd3c [DXGTHK] Export DriverEntry (#5607)
Export driver entry point function DriverEntry from our dxgthk.sys,
following Windows behaviur. It is exported on XP SP3 and Server 2003.
2023-09-21 14:25:21 +03:00
Katayama Hirofumi MZ
539123c62f [SHELL32] SHChangeRegistrationReceive just returns FALSE 2023-09-21 12:09:28 +09:00
Katayama Hirofumi MZ
29e1a41d07 [SHELL32][SDK] Implement SHGetShellStyleHInstance (#5707)
Co-authored-by: Oleg Dubinskiy <oleg.dubinskij30@gmail.com>
This PR supersedes PR #3851.
- Implement SHGetShellStyleHInstance function.
- Add SHGetShellStyleHInstance prototype to <shlobj.h>.
CORE-17707
2023-09-21 09:22:33 +09:00
Katayama Hirofumi MZ
6c55a3aa2a [SHELL32][SHELL32_APITEST][SDK] Implement Int64ToString (#5706)
- Implement Int64ToString and LargeIntegerToString functions.
- Add Int64ToString and LargeIntegerToString prototypes to <shellundoc.h>.
- Add Int64ToString testcase.
- I found a bug in GetNumberFormat.LeadingZero.

http://undoc.airesoft.co.uk/shell32.dll/Int64ToString.php
http://undoc.airesoft.co.uk/shell32.dll/LargeIntegerToString.php
2023-09-21 09:14:40 +09:00
Julio Carchi
4651faeaa2 [BOOTDATA] Add TEMP folder to livecd image (#5683)
Create the folder TEMP in X:\reactos so now we can match current livecd
environment variables TMP and TEMP
can be seen as a part of solving CORE-13041

The use-case for that is:
copying the livecd folder structure directly to writable media as USB sticks or memory cards,
will work then out-of-the-box without any other change.
2023-09-20 18:57:04 +00:00
Jose Carlos Jesus
02883d1c16 [SDK:RTL] RtlpCallQueryRegistryRoutine(): Correctly set SpareData and SpareLength (#5466)
SpareData and SpareLength need to be calculated correctly, as they are used
later in that function as well.
This allows to not overwrite Source UString when writing to Destination UString.

Fixes the problem described in the following JIRA issue, where services could
not start when installing ReactOS in a very-long-named directory.

CORE-18988
2023-09-20 18:06:06 +02:00
Katayama Hirofumi MZ
ebfec38cd1 [ATL][ATL_APITEST] Independent ReactOS ATL (RATL) support (#5657)
This is an attempt to make ReactOS ATL (RATL) independent.
https://github.com/katahiromz/RATL
CORE-19153
2023-09-20 12:02:33 +09:00
Johannes Thoma
490fbfb2c5 [DDK] wsk header: Add WSKAPI to exported functions. (#5687)
Names need decoration (stdcall) in order to be linked.

When using the wsk.h header functions exported therein should
be WSKAPI (which enforces the stdcall calling convention). Linking
would later fail because stdcall functions are named differently in
the object code.
2023-09-19 18:28:19 +03:00
Katayama Hirofumi MZ
8d74bc4b46 [ATL] CImage: Follow-up to #5702 (5da3ed6)
Fix the return value of CImage::Detach. CORE-19008
2023-09-20 00:04:45 +09:00
Katayama Hirofumi MZ
5da3ed638b [ATL] Fix CImage members (#5702)
- Delete m_ds and m_bm members from CImage.
- Add m_nWidth, m_nHeight, m_nPitch, m_nBPP,
  and m_pBits members.
CORE-19008
2023-09-19 22:19:03 +09:00
Katayama Hirofumi MZ
6911fab69a [COMDLG32] Implement CDM_SETDEFEXT (#5704)
- CDM_SETDEFEXT message handling was a 
  missing feature of COMDLG32.
- Make info->defext dynamic allocation.
- On CDM_SETDEFEXT handling, replace
  info->defext data.
CORE-15020
2023-09-19 22:17:48 +09:00
Katayama Hirofumi MZ
3fa90b539e [ATL] Default value of dwInitParam is zero instead of NULL (#5703)
Fix warnings when dwInitParam was omitted at CDialogImpl::Create and/or CDialogImpl::DoModal.
2023-09-19 17:28:33 +09:00
Katayama Hirofumi MZ
ff5ccb5948 [SHLWAPI][SHLWAPI_APITEST] Fix SHGetPerScreenResName (#5701)
Use HORZRES and VERTRES instead of SM_CXFULLSCREEN and SM_CYFULLSCREEN.
CORE-9283
2023-09-19 11:02:59 +09:00
Katayama Hirofumi MZ
08cc45eef9 [ATL_APITEST] atlconv: Disable corner case test of CWAEX 2023-09-19 10:45:46 +09:00
Justin Miller
6bbf09b6a5 [WINESYNC][SDK][DWMAPI] Import DWMAPI from WINE 8-14 (#5594) 2023-09-18 07:30:44 -07:00
Joachim Henze
0eecebb1cc [KBDLAYOUT] Avoid (DLGPROC) cast (#5698)
- Avoid DLGPROC-cast
- Bring header-section closer to our coding guidelines
- Strip inconsistent empty-lines
- Strip useless return at the end of void func

Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
2023-09-18 11:48:33 +00:00
Katayama Hirofumi MZ
1da71e2519 [SHDOCVW][SHDOCVW_APITEST] Implement MRU List for Shell Bag, Part 6 (#5699)
Follow-up to #5691. Strengthen shdocvw_apitest
testcase. Fix CLSID_MruPidlList class.
CORE-9283
2023-09-18 20:13:29 +09:00
Joachim Henze
1e06be778b [IMAGELISTVIEWER] Avoid (DLGPROC) cast (#5697) 2023-09-18 10:22:59 +00:00
1075 changed files with 52813 additions and 19783 deletions

View File

@@ -336,14 +336,12 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
add_subdirectory(sdk/include/reactos/mc)
add_subdirectory(sdk/include/asm)
if(NO_ROSSYM)
if(ARCH MATCHES "64$")
include(sdk/cmake/baseaddress64.cmake)
elseif(NO_ROSSYM)
include(sdk/cmake/baseaddress_dwarf.cmake)
elseif(MSVC)
if (ARCH STREQUAL "amd64")
include(sdk/cmake/baseaddress_msvc_x64.cmake)
else()
include(sdk/cmake/baseaddress_msvc.cmake)
endif()
include(sdk/cmake/baseaddress_msvc.cmake)
else()
include(sdk/cmake/baseaddress.cmake)
endif()

View File

@@ -1,5 +1,4 @@
#ifndef __CALC_H__
#define __CALC_H__
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -16,6 +15,7 @@
#include <htmlhelp.h>
#endif
#include <limits.h>
#include <strsafe.h>
/* RESOURCES */
#include "resource.h"
@@ -280,5 +280,3 @@ INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
void ConvExecute(HWND hWnd);
void ConvAdjust(HWND hWnd, int n_cat);
void ConvInit(HWND hWnd);
#endif /* __CALC_H__ */

View File

@@ -429,8 +429,8 @@ END
/* Angles */
STRINGTABLE
BEGIN
IDS_ANGLE_ARCMINUTES "Minute of arc"
IDS_ANGLE_ARCSECONDS "Second of arc"
IDS_ANGLE_ARCMINUTES "Угловая минута"
IDS_ANGLE_ARCSECONDS "Угловая секунда"
IDS_ANGLE_DEGREES "градус"
IDS_ANGLE_GRADIANS "град"
IDS_ANGLE_RADIANS "радиан"

View File

@@ -19,7 +19,7 @@
*/
#include <windef.h>
#include <winuser.h>
#include <winuser.rh>
#include "resource.h"

View File

@@ -27,7 +27,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
switch (base) {
case IDC_RADIO_HEX:
_stprintf(buffer, _T("%I64X"), rpn->i);
StringCchPrintf(buffer, size, _T("%I64X"), rpn->i);
break;
case IDC_RADIO_DEC:
/*
@@ -40,11 +40,11 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
/* calculate the width of integer number */
width = (rpn->f==0) ? 1 : (int)log10(fabs(rpn->f))+1;
if (calc.sci_out == TRUE || width > MAX_LD_WIDTH || width < -MAX_LD_WIDTH)
_stprintf(buffer, _T("%#.*e"), MAX_LD_WIDTH-1, rpn->f);
StringCchPrintf(buffer, size, _T("%#.*e"), MAX_LD_WIDTH-1, rpn->f);
else {
TCHAR *ptr, *dst;
ptr = buffer + _stprintf(buffer, _T("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
StringCchPrintfEx(buffer, size, &ptr, NULL, 0, _T("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
/* format string ensures there is a '.': */
dst = _tcschr(buffer, _T('.'));
while (--ptr > dst)
@@ -61,7 +61,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
#undef MAX_LD_WIDTH
break;
case IDC_RADIO_OCT:
_stprintf(buffer, _T("%I64o"), rpn->i);
StringCchPrintf(buffer, size, _T("%I64o"), rpn->i);
break;
case IDC_RADIO_BIN:
if (rpn->i == 0) {

View File

@@ -107,7 +107,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
}
mpz_clear(zz);
mpf_clear(ff);
_sntprintf(buffer, SIZEOF(calc.buffer), _T("%hs"), temp);
StringCchPrintf(buffer, size, _T("%hs"), temp);
}
void convert_text2number_2(calc_number_t *a)

View File

@@ -254,10 +254,10 @@ static void UpdateNumberIntl(void)
{
/* Get current user defaults */
if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, calc.sDecimal, SIZEOF(calc.sDecimal)))
_tcscpy(calc.sDecimal, _T("."));
StringCbCopy(calc.sDecimal, sizeof(calc.sDecimal), _T("."));
if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, calc.sThousand, SIZEOF(calc.sThousand)))
_tcscpy(calc.sThousand, _T(","));
StringCbCopy(calc.sThousand, sizeof(calc.sThousand), _T(","));
/* get the string lengths */
calc.sDecimal_len = _tcslen(calc.sDecimal);
@@ -342,7 +342,7 @@ static void save_config(void)
switch (osvi.dwPlatformId) {
case VER_PLATFORM_WIN32s:
case VER_PLATFORM_WIN32_WINDOWS:
_stprintf(buf, _T("%lu"), calc.layout);
StringCbPrintf(buf, sizeof(buf), _T("%lu"), calc.layout);
WriteProfileString(_T("SciCalc"), _T("layout"), buf);
WriteProfileString(_T("SciCalc"), _T("UseSep"), (calc.usesep==TRUE) ? _T("1") : _T("0"));
break;
@@ -496,16 +496,16 @@ static void update_lcd_display(HWND hwnd)
TCHAR tmp[MAX_CALC_SIZE * 2 + 2];
if (calc.buffer[0] == _T('\0'))
_tcscpy(tmp, _T("0"));
StringCbCopy(tmp, sizeof(tmp), _T("0"));
else
_tcscpy(tmp, calc.buffer);
StringCbCopy(tmp, sizeof(tmp), calc.buffer);
/* Add final '.' in decimal mode (if it's missing), but
* only if it's a result: no append if it prints "ERROR".
*/
if (calc.base == IDC_RADIO_DEC && !calc.is_nan) {
if (_tcschr(tmp, _T('.')) == NULL)
_tcscat(tmp, _T("."));
StringCbCat(tmp, sizeof(tmp), _T("."));
}
/* if separator mode is on, let's add an additional space */
if (calc.usesep && !calc.sci_in && !calc.sci_out && !calc.is_nan) {
@@ -573,13 +573,14 @@ static void update_parent_display(HWND hWnd)
if (!n)
str[0] = _T('\0');
else
_stprintf(str,_T("(=%d"), n);
StringCbPrintf(str, sizeof(str), _T("(=%d"), n);
SetDlgItemText(hWnd, IDC_TEXT_PARENT, str);
}
static void build_operand(HWND hwnd, DWORD idc)
{
unsigned int i = 0, n;
size_t cbPtr;
if (idc == IDC_BUTTON_DOT) {
/* if dot is the first char, it's added automatically */
@@ -617,12 +618,14 @@ static void build_operand(HWND hwnd, DWORD idc)
if (idc != IDC_STATIC)
calc.esp = (calc.esp * 10 + (key2code[i].key-'0')) % LOCAL_EXP_SIZE;
if (calc.ptr == calc.buffer)
_stprintf(calc.ptr, _T("0.e%+d"), calc.esp);
StringCbPrintf(calc.ptr, sizeof(calc.buffer), _T("0.e%+d"), calc.esp);
else {
/* adds the dot at the end if the number has no decimal part */
if (!_tcschr(calc.buffer, _T('.')))
*calc.ptr++ = _T('.');
_stprintf(calc.ptr, _T("e%+d"), calc.esp);
cbPtr = sizeof(calc.buffer) - ((BYTE*)calc.ptr - (BYTE*)calc.buffer);
StringCbPrintf(calc.ptr, cbPtr, _T("e%+d"), calc.esp);
}
update_lcd_display(hwnd);
return;
@@ -637,7 +640,11 @@ static void build_operand(HWND hwnd, DWORD idc)
return;
break;
}
calc.ptr += _stprintf(calc.ptr, _T("%C"), key2code[i].key);
cbPtr = sizeof(calc.buffer) - ((BYTE*)calc.ptr - (BYTE*)calc.buffer);
StringCbPrintfEx(calc.ptr, cbPtr, &calc.ptr, NULL, STRSAFE_FILL_ON_FAILURE,
_T("%C"), key2code[i].key);
update_lcd_display(hwnd);
}
@@ -850,11 +857,11 @@ static void update_memory_flag(HWND hWnd, BOOL mem_flag)
SetDlgItemText(hWnd, IDC_TEXT_MEMORY, mem_flag ? _T("M") : _T(""));
}
static void update_n_stats_items(HWND hWnd, TCHAR *buffer)
static void update_n_stats_items(HWND hWnd, TCHAR *buffer, size_t cbBuffer)
{
unsigned int n = SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_GETCOUNT, 0, 0);
_stprintf(buffer, _T("n=%u"), n);
StringCbPrintf(buffer, cbBuffer, _T("n=%u"), n);
SetDlgItemText(hWnd, IDC_TEXT_NITEMS, buffer);
}
@@ -905,7 +912,7 @@ static char *ReadConversion(const char *formula)
str[len+1] = ')';
str[len+2] = '\0';
_tcscpy(calc.source, (*calc.buffer == _T('\0')) ? _T("0") : calc.buffer);
StringCbCopy(calc.source, sizeof(calc.source), (*calc.buffer == _T('\0')) ? _T("0") : calc.buffer);
/* clear display content before proceeding */
calc.ptr = calc.buffer;
@@ -942,13 +949,13 @@ static INT_PTR CALLBACK DlgStatProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
if (n == LB_ERR)
return TRUE;
SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_DELETESTRING, (WPARAM)n, 0);
update_n_stats_items(hWnd, buffer);
update_n_stats_items(hWnd, buffer, sizeof(buffer));
delete_stat_item(n);
return TRUE;
case IDC_BUTTON_CAD:
SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_RESETCONTENT, 0, 0);
clean_stat_list();
update_n_stats_items(hWnd, buffer);
update_n_stats_items(hWnd, buffer, sizeof(buffer));
return TRUE;
}
break;
@@ -964,7 +971,7 @@ static INT_PTR CALLBACK DlgStatProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
buffer, SIZEOF(buffer),
((statistic_t *)lp)->base);
SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_ADDSTRING, 0, (LPARAM)buffer);
update_n_stats_items(hWnd, buffer);
update_n_stats_items(hWnd, buffer, sizeof(buffer));
return TRUE;
}
return FALSE;
@@ -986,11 +993,13 @@ static void CopyMemToClipboard(void *ptr)
if(OpenClipboard(NULL)) {
HGLOBAL clipbuffer;
TCHAR *buffer;
size_t cbBuffer;
EmptyClipboard();
clipbuffer = GlobalAlloc(GMEM_DDESHARE, (_tcslen(ptr)+1)*sizeof(TCHAR));
cbBuffer = (_tcslen(ptr) + 1) * sizeof(TCHAR);
clipbuffer = GlobalAlloc(GMEM_DDESHARE, cbBuffer);
buffer = (TCHAR *)GlobalLock(clipbuffer);
_tcscpy(buffer, ptr);
StringCbCopy(buffer, cbBuffer, ptr);
GlobalUnlock(clipbuffer);
#ifdef UNICODE
SetClipboardData(CF_UNICODETEXT,clipbuffer);
@@ -1056,9 +1065,8 @@ static char *handle_sequence_input(HWND hwnd, sequence_t *seq)
}
} else
if (ch == '$') {
calc.ptr =
_tcscpy(calc.buffer, calc.source) +
_tcslen(calc.source);
StringCbCopyEx(calc.buffer, sizeof(calc.buffer), calc.source, &calc.ptr, NULL,
STRSAFE_FILL_ON_FAILURE);
} else {
for (x=0; x<SIZEOF(key2code); x++) {
if (!(key2code[x].mask & BITMASK_IS_ASCII) ||

View File

@@ -54,5 +54,5 @@ BEGIN
IDS_ABOUT "&О программе..."
IDS_TITLE "Таблица символов"
IDS_UNICODE "Unicode"
IDS_ALL "All"
IDS_ALL "Все"
END

View File

@@ -1,4 +1,11 @@
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
/*
* PROJECT: ReactOS Clipboard
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
ID_ACCEL ACCELERATORS
@@ -11,7 +18,7 @@ BEGIN
POPUP "&Fișier"
BEGIN
MENUITEM "&Deschidere…", CMD_OPEN
MENUITEM "Păst&rare ca…", CMD_SAVE_AS
MENUITEM "S&alvează ca…", CMD_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "I&eșire", CMD_EXIT
END

View File

@@ -31,7 +31,7 @@ id Порядковый номер запланированно
IDS_CONFIRM_YES "Y"
IDS_CONFIRM_NO "N"
IDS_DELETE_ALL "This operation will delete all scheduled jobs.\n"
IDS_DELETE_ALL "Эта операция удалит все запланированные задачи.\n"
IDS_NEW_JOB "Добавлено новое задание с ID = %lu\n"
IDS_JOBS_LIST "Статус ID День Время Команда\n"
IDS_NO_ENTRIES "В списке нет запланированных задач.\n"

View File

@@ -3,6 +3,7 @@
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2014 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -23,6 +24,6 @@ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] fișier ...\n\
Tastați ATTRIB fără argumente pentru afișarea atributelor pentru\n\
toate fișierele.\n"
STRING_CONSOLE_ERROR "Eroare necunoscută: %d\n"
STRING_FILE_NOT_FOUND "File not found - '%s'\n"
STRING_FILE_NOT_FOUND "Fișierul nu a fost găsit - '%s'\n"
STRING_ERROR_INVALID_PARAM_FORMAT "Formatul argumentului este eronat - %s\n"
END

View File

@@ -26,6 +26,6 @@ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] файл ...\n\
/D Обработка и файлов, и папок.\n\n\
Команда ATTRIB без параметров выводит атрибуты всех файлов.\n"
STRING_CONSOLE_ERROR "Неизвестная ошибка: %d\n"
STRING_FILE_NOT_FOUND "File not found - '%s'\n"
STRING_FILE_NOT_FOUND "Файл не найден - '%s'\n"
STRING_ERROR_INVALID_PARAM_FORMAT "Неверный формат параметра - %s\n"
END

View File

@@ -9,7 +9,7 @@ COMP [/L] [/A] [данные1] [данные2]\n\n\
/A Вывод различий в формате ASCII (по умолчанию: шестнадцатиричный).\n\
/L Вывод номеров строк, в которых обнаружены различия.\n"
IDS_INVALIDSWITCH "Недопустимый ключ - /%c\n"
IDS_BADSYNTAX "Не верный формат командной строки\n"
IDS_BADSYNTAX "Неверный формат командной строки\n"
IDS_FILEERROR "Не удалось найти/открыть файл: %s\n"
IDS_COMPARING "Сравнение %s и %s...\n"
IDS_FILESIZEERROR "Не удалось определить размер файла: %s\n"

View File

@@ -30,9 +30,9 @@ FC /B [диск1:][путь1]имя_файла1 [диск2:][путь2]имя_ф
IDS_LONGER_THAN "FC: %ls длиннее, чем %ls\n"
IDS_COMPARING "Сравнение файлов %ls и %ls\n"
IDS_OUT_OF_MEMORY "FC: Недостаточно памяти\n"
IDS_CANNOT_READ "FC: не удаётся прочитать %ls\n"
IDS_CANNOT_READ "FC: Не удаётся прочитать %ls\n"
IDS_INVALID_SWITCH "FC: Недопустимый ключ\n"
IDS_CANNOT_OPEN "FC: не удаётся открыть %ls - файл либо папка не существует\n"
IDS_CANNOT_OPEN "FC: Не удаётся открыть %ls - файл либо папка не существует\n"
IDS_NEEDS_FILES "FC: Недостаточное количество имён файлов\n"
IDS_CANT_USE_WILDCARD "Подстановочные знаки ('*' и '?') пока не поддерживаются\n"
IDS_DIFFERENT "FC: Файлы %ls и %ls различны\n"

View File

@@ -1,9 +1,9 @@
/*
* FILE: base/applications/cmdutils/find/lang/ro-RO.rc
* ReactOS Project (https://reactos.org)
* TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan)
* CHANGE LOG: 2011-08-20 initial translation
* 2011-10-17 diacritics change, other minor changes
* PROJECT: ReactOS Find Command
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -16,8 +16,9 @@ FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] ""șir"" [fișier...]\n\
/C Numără liniile ce conțin șirul.\n\
/N Numără rândurile afișate, începând cu 1.\n\
/I Ignoră diferențele între majuscule și minuscule.\n\
/OFF[LINE] Do not skip files that have the offline attribute set."
/OFF[LINE] Nu omite fișierele care au configurate atributul\n\
offline (deconectat)."
IDS_NO_SUCH_FILE "FIND: Fișierul «%s» nu există!\n"
IDS_CANNOT_OPEN "FIND: Fișierul «%s» nu poate fi deschis!\n"
IDS_INVALID_SWITCH "FIND: Invalid switch\n"
IDS_INVALID_SWITCH "FIND: Comutare nevalidă\n"
END

View File

@@ -8,11 +8,11 @@ FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] ""строка"" [[диск:][путь]и
/C Вывод только общего числа строк, содержащих заданную строку.\n\
/N Вывод номеров отображаемых строк.\n\
/I Поиск без учета регистра символов.\n\
/OFF[LINE] Do not skip files that have the offline attribute set.\n\
/OFF[LINE] Не пропускать файлы, у которых установлен атрибут offline.\n\
""строка"" Искомая строка.\n\
[диск:][путь]имя_файла\n\
Один или несколько файлов, в которых выполняется поиск."
IDS_NO_SUCH_FILE "FIND: %s: Файл не существует.\n"
IDS_CANNOT_OPEN "FIND: %s: Невозможно открыть файл.\n"
IDS_INVALID_SWITCH "FIND: Invalid switch\n"
IDS_INVALID_SWITCH "FIND: Недопустимый ключ\n"
END

View File

@@ -1,20 +1,26 @@
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
/*
* PROJECT: ReactOS Label Command
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
// STRING_LABEL_HELP "Afișează sau modifică eticheta unei unități (de stocare).\n\nLABEL [unitate:][etichetă]\n"
STRING_LABEL_HELP "Creates, changes or deletes the volume label of a disk.\n\n\
LABEL [drive:][label]\n\n\
drive: Specifies the drive letter of a drive.\n\
label Specifies the label of the drive."
STRING_LABEL_TEXT1 "Volumul unității %c: este etichetat ca %s\n"
STRING_LABEL_TEXT2 "Volumul unității %c: nu este etichetat.\n"
STRING_LABEL_HELP "Crea, schimbă sau șterge denumirea unui dispozitiv.\n\n\
LABEL [dispozitiv:][denumire]\n\n\
dispozitiv: Specifică litera unui dispozitiv.\n\
denumire Specifică denumirea unui dispozitiv."
STRING_LABEL_TEXT1 "Volumul unității %c: este denumit ca %s\n"
STRING_LABEL_TEXT2 "Volumul unității %c: nu este denumit.\n"
STRING_LABEL_TEXT3 "Numărul de serie al volumului este %04X-%04X\n"
STRING_LABEL_TEXT4 "Introduceți eticheta unității (opțională, de 32 caractere), apoi ENTER "
STRING_LABEL_PROMPT "Delete current volume label (Y/N)? "
STRING_LABEL_OPTIONS "YN"
STRING_LABEL_TEXT4 "Introduceți denumirea unității (opțională, de 32 caractere), apoi ENTER "
STRING_LABEL_PROMPT "Ștergeți denumirea actuală a volumului (Da/Nu)? "
STRING_LABEL_OPTIONS "DaNu"
STRING_ERROR_INVALID_DRIVE "Specificarea unității este eronată\n"
STRING_ERROR_INVALID_LABEL "Invalid volume label\n"
STRING_ERROR_INVALID_LABEL "Denumirea volumului e nevalidă\n"
END

View File

@@ -1,60 +1,65 @@
/*
* FILE: base/applications/cmdutils/more/lang/ro-RO.rc
* ReactOS Project (https://reactos.org)
* TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan)
* CHANGE LOG: 2011-08-20 initial translation
* 2011-10-17 diacritics change, other minor changes
* PROJECT: ReactOS More Command
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_USAGE "Afișea date pe ecran, pagină-cu-pagină.\n\
IDS_USAGE "Afișarea datelor pe ecran, pagină cu pagină.\n\
\n\
MORE [/E [options]] < [drive:][path]filename\n\
command | MORE [/E [options]]\n\
MORE [/E [opțiuni]] < [dispozitiv:][cale]numele fișierului\n\
command | MORE [/E [opțiuni]\n\
\n\
[drive:][path]filename A file whose contents are to be displayed.\n\
command A command whose output is to be displayed.\n\
[dispozitiv:][cale]numele fișierului Un fișier al cărui conținut\n\
urmează să fie afișat.\n\
comandă O comandă a cărei ieșire\n\
urmează să fie afișată.\n\
\n\
When Extended Features are enabled, the following form is supported:\n\
MORE [/E] [options] [files]\n\
Atunci când opțiunea Caracteristici extinse e activată,\n\
următoarea formă este acceptată:\n\
MORE [/E] [opțiuni] [fișiere]\n\
\n\
Options:\n\
/E Enable Extended Features.\n\
The default state of the Extended Features is controlled by the default\n\
registry settings for CMD.EXE. For more details on how to change these\n\
settings, see the section ""Command Extensions"" in CMD.EXE help.\n\
Opțiuni:\n\
/E Activarea opțiunii Caracteristici extinse.\n\
Stadiul implicit al Caracteristicilor extinse e controlat de setările\n\
implicite de registru pentru programul CMD.EXE. Pentru mai multe detalii\n\
legate de cum pot fi schimbate aceste setări, vedeți secțiunea\n\
""Extensii de comenzi"" în secțiunea de ajutor a programului CMD.EXE.\n\
\n\
When Extended Features are enabled, the following options are available:\n\
/C Clear the screen before displaying a page.\n\
/P Expand Form-Feed characters.\n\
/S Shrink successive blank lines to a single line.\n\
/Tn Expand tabs to n spaces (default: 8).\n\
Atunci când opțiunea Caracteristici extinse e activată, sunt disponibile\n\
următoarele opțiuni:\n\
/C Curățarea ecranului înainte de a se afișa o pagină.\n\
/P Extinderea caracterelor Form-Feed (de alimentare de formulare).\n\
/S Reducerea liniilor goale succesive la o singură linie.\n\
/Tn Extinderea tab-urilor la n spații (implicit: 8).\n\
\n\
These options can be specified in the MORE environment variable.\n\
Aceste opțiuni pot fi specificate în variabila de mediu MORE.\n\
\n\
+n Start displaying the first file at line n.\n\
files List of files to display, separated by blanks.\n\
+n Începerea afișării primului fișier la linia n.\n\
fișiere Lista fișierelor de afișat, separate prin spații libere.\n\
\n\
When Extended Features are enabled, the following commands are available\n\
at the ""-- Continue --"" prompt:\n\
Atunci când opțiunea Caracteristici extinse e activată, sunt disponibile\n\
următoarele comenzi la panoul ""-- Continuă --"":\n\
\n\
P n Display the next n lines.\n\
S n Skip the next n lines.\n\
F Display the next file.\n\
Q Quit.\n\
= Show the line number.\n\
? Show the help line.\n\
<Space> Display the next page.\n\
<Enter> Display the next line.\n"
P n Afișarea următoarelor n linii.\n\
S n Omiterea următoarelor n linii.\n\
F Afișarea următorului fișier.\n\
Q Ieșire.\n\
= Afișarea numărului de linie.\n\
? Afișarea liniei de ajutor.\n\
<Space> Afișarea următoarei pagini.\n\
<Enter> Afișarea următoari linii.\n"
IDS_BAD_FLAG "Invalid argument - '%s'\n"
IDS_BAD_FLAG "Argument nevalid - '%s'\n"
IDS_FILE_ACCESS "Fișierul «%s» nu poate fi accesat!\n"
IDS_CONTINUE_PROMPT "-- Continuă%1%2%3 --%4"
IDS_CONTINUE_PERCENT " (%d%%)"
IDS_CONTINUE_LINE_AT " [Line: %d]"
IDS_CONTINUE_OPTIONS " [Options: psfq=<Space><Enter>]"
IDS_CONTINUE_LINES " Lines: "
IDS_CONTINUE_LINE_AT " [Linie: %d]"
IDS_CONTINUE_OPTIONS " [Opțiuni: psfq=<Space><Enter>]"
IDS_CONTINUE_LINES " Linii: "
END

View File

@@ -1,4 +1,10 @@
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
/*
* PROJECT: ReactOS Taskkill Command
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -18,6 +24,6 @@ STRINGTABLE
STRING_ENUM_FAILED, "Eroare: Procesele nu au putut fi enumerate.\n"
STRING_TERMINATE_FAILED, "Eroare: Procesul «%1» nu poate fi oprit.\n"
STRING_SELF_TERMINATION, "Eroare: Auto-terminarea nu este permisă.\n"
STRING_PARAM_TOO_MUCH, "Error: Invalid syntax. '%1' option is not allowed more than '%2!d!' time(s).\n"
STRING_INVALID_SYNTAX, "Error: Invalid syntax.\n"
STRING_PARAM_TOO_MUCH, "Eroare: Sintaxă nevalidă. Opțiunea '%1' nu este permisă mai mult de '%2!d!' dată(dăți).\n"
STRING_INVALID_SYNTAX, "Eroare: Sintaxă nevalidă.\n"
}

View File

@@ -52,7 +52,7 @@ XCOPY источник [целевой_объект] [/I] [/S] [/Q] [/F] [/L] [/
/A Копирует только те файлы, для которых установлен атрибут ""архивный"".\n\
/M Копирует только те файлы, для которых установлен атрибут ""архивный"",\n\
при этом атрибут удаляется.\n\
[/K] Copy file attributes, without this attributes are not preserved.\n\
[/K] Копирует атрибуты файлов, без этого атрибуты не сохраняются.\n\
/D | /D:m-d-y Копирование файлов, измененных не ранее указанной даты.\n\
Если дата не указана, заменяются только конечные файлы,\n\
более старые, чем исходные.\n"

View File

@@ -1,7 +1,9 @@
/*
* FILE: base/applications/dxdiag/lang/ro-RO.rc
* ReactOS Project (https://reactos.org)
* TRANSLATOR: Ștefan Fulea (stefan dot fulea at mail dot com)
* PROJECT: ReactOS DX Diagnostic
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -15,7 +17,7 @@ BEGIN
CONTROL "Tab1", IDC_TAB_CONTROL, "SysTabControl32", WS_TABSTOP, 2, 2, 474, 250
PUSHBUTTON "&Manual…", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
DEFPUSHBUTTON "&Următorul compartiment", IDC_BUTTON_NEXT, 187, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Păstrare informații…", IDC_BUTTON_SAVE_INFO, 311, 260, 110, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
PUSHBUTTON "S&alvare informații…", IDC_BUTTON_SAVE_INFO, 311, 260, 110, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
PUSHBUTTON "Î&nchide", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
@@ -23,7 +25,7 @@ IDD_SYSTEM_DIALOG DIALOGEX 0, 0, 462, 220
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Acest instrument oferă informații detaliate despre componentele ReactX și modulele-pilot instalate în sistem.", IDC_STATIC, 5, 0, 443, 17
LTEXT "Acest instrument oferă informații detaliate despre componentele ReactX și drivere instalate în sistem.", IDC_STATIC, 5, 0, 443, 17
LTEXT "Dacă aveți la cunoștință careva probleme la o anumită categorie, mergeți la compartimentul corespunzător de mai sus. Altfel, puteți utiliza butonul „Următorul compartiment” de mai jos pentru a trece secvențial prin fiecare categorie.", IDC_STATIC, 5, 15, 443, 25
GROUPBOX "Informații despre sistem", IDC_STATIC, 5, 35, 452, 150, SS_RIGHT
LTEXT "Data/Ora curentă:", IDC_STATIC, 70, 50, 80, 10, SS_RIGHT

View File

@@ -1,17 +1,23 @@
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
/*
* PROJECT: ReactOS fltmc utility
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_USAGE "\nComenzi valide:\n\
load Încarcă un modul-pilot de tip filtru\n\
unload Descarcă un modul-pilot de tip filtru\n\
load Încarcă un driver de tip filtru\n\
unload Descarcă un driver de tip filtru\n\
filters Afișează filtrele înregistrate acum în sistem\n\n\
volumes Afișează toate volumele\n\n"
IDS_USAGE_LOAD "Încarcă un modul-pilot de tip filtru\n"
IDS_USAGE_UNLOAD "Descarcă un modul-pilot de tip filtru\n"
IDS_USAGE_LOAD "Încarcă un driver de tip filtru\n"
IDS_USAGE_UNLOAD "Descarcă un driver de tip filtru\n"
IDS_USAGE_FILTERS "Afișează toate filtrele înregistrate\n"
IDS_USAGE_VOLUMES "Afișează toate volumele\n"
END
@@ -25,7 +31,7 @@ END
STRINGTABLE
BEGIN
IDS_ERROR_PRIV "Eșec la instituirea dreptului de încărcare pentru modulul-pilot (0x%X)\n"
IDS_ERROR_PRIV "Eșec la instituirea dreptului de încărcare pentru driverul (0x%X)\n"
IDS_ERROR_FILTERS "Eșec la afișarea filtrelor (0x%X)\n"
IDS_ERROR_LOAD "Eșec la încărcarea filtrului (0x%X)\n"
IDS_ERROR_UNLOAD "Eșec la descărcarea filtrului (0x%X)\n"

View File

@@ -11,7 +11,7 @@ BEGIN
IDS_USAGE_LOAD "Загружает драйвер фильтра\n"
IDS_USAGE_UNLOAD "Выгружает драйвер фильтра\n"
IDS_USAGE_FILTERS "Выводит список всех зарегистрированных фильтров\n"
IDS_USAGE_VOLUMES "Lists all volumes\n"
IDS_USAGE_VOLUMES "Выводит список всех томов\n"
END
STRINGTABLE
@@ -27,5 +27,5 @@ BEGIN
IDS_ERROR_FILTERS "Не удалось получить список фильтров (0x%X)\n"
IDS_ERROR_LOAD "Не удалось загрузить фильтр (0x%X)\n"
IDS_ERROR_UNLOAD "Не удалось выгрузить фильтр (0x%X)\n"
IDS_ERROR_VOLUMES "Failed to list the volumes (0x%X)\n"
IDS_ERROR_VOLUMES "Не удалось получить список томов (0x%X)\n"
END

View File

@@ -4,7 +4,7 @@
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2009 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2018 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2022 Andrei Miloiu <miloiuandrei@gmail.com>
* Copyright 2022-2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -25,7 +25,7 @@ BEGIN
AUTORADIOBUTTON "Fă&ră", IDC_OPT_NOSCORE, 107, 45, 60, 10
AUTOCHECKBOX "&Afișează timp", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP
AUTOCHECKBOX "&Bară de stare", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP
AUTOCHECKBOX "&Păstrează scorul", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP
AUTOCHECKBOX "Salvea&ză scorul", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP
DEFPUSHBUTTON "Con&firmă", IDOK, 35, 97, 50, 14
PUSHBUTTON "A&nulează", IDCANCEL, 101, 97, 50, 14
END

View File

@@ -145,16 +145,9 @@ static VOID UpdateLayoutList(HKL hKL OPTIONAL)
if (!hKL)
{
if (0 <= (g_nCurrentLayoutNum - 1) && (g_nCurrentLayoutNum - 1) < g_cKLs)
{
hKL = g_ahKLs[g_nCurrentLayoutNum - 1];
}
else
{
HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow());
DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
hKL = GetKeyboardLayout(dwTID);
}
HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow());
DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
hKL = GetKeyboardLayout(dwTID);
}
g_cKLs = GetKeyboardLayoutList(ARRAYSIZE(g_ahKLs), g_ahKLs);
@@ -737,6 +730,8 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONUP:
case WM_LBUTTONUP:
{
UpdateLayoutList(NULL);
GetCursorPos(&pt);
SetForegroundWindow(hwnd);

View File

@@ -1,6 +1,10 @@
/*
* Translators: Petru Dimitriu (petrimetri at gmail dot com)
* Ștefan Fulea (stefan dot fulea at mail dot com)
* PROJECT: ReactOS Magnifier
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -35,7 +39,7 @@ END
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Configurare lupă"
CAPTION "Setările lupei"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Î&nchide", IDOK, 96, 161, 50, 14

View File

@@ -28,8 +28,8 @@ BEGIN
BEGIN
MENUITEM "&Nou\tCtrl+N", IDM_FILE_NEW
MENUITEM "&Deschide\tCtrl+O", IDM_FILE_OPEN
MENUITEM "&Păstrează", IDM_FILE_SAVE
MENUITEM "Păst&rare în…", IDM_FILE_SAVEAS
MENUITEM "S&alvează", IDM_FILE_SAVE
MENUITEM "Sal&vează ca…", IDM_FILE_SAVEAS
MENUITEM SEPARATOR
MENUITEM "I&eșire\tAlt+F4", IDM_FILE_EXIT
END

View File

@@ -1,4 +1,10 @@
/* Ștefan Fulea (stefan dot fulea at mail dot com) */
/*
* PROJECT: ReactOS System Configuration Tool
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -68,8 +74,8 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "Moduri de pornire sistem", -1, 10, 10, 340, 150, 0, WS_EX_TRANSPARENT
CONTROL "Pornire n&ormală - încarcă toate serviciile și modulele-pilot", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 260, 10
CONTROL "Pornire de &diagnostic - încarcă doar modulele-pilot de bază", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 260, 10
CONTROL "Pornire n&ormală - încarcă toate serviciile și driverele", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 260, 10
CONTROL "Pornire de &diagnostic - încarcă doar driverele de bază", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 260, 10
CONTROL "Pornire s&electivă", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 260, 10
AUTOCHECKBOX "&Procesează fișierul SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 260, 10
AUTOCHECKBOX "Încarcă se&rviciile de sistem", IDC_CBX_SYSTEM_SERVICE, 30, 95, 260, 10

View File

@@ -1,4 +1,10 @@
/* Ștefan Fulea (stefan dot fulea at mail dot com) */
/*
* PROJECT: ReactOS System Configuration Tool
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -10,7 +16,7 @@ BEGIN
ICON IDI_APPICON, IDC_STATIC, 14, 14, 20, 20
LTEXT "Program de configurare al sistemului\nVersiune 1.0", IDC_STATIC, 42, 14, 182, 17, SS_NOPREFIX
// "Copyright (C) ReactOS Team 2005-"COPYRIGHT_YEAR"\n"
LTEXT "Drept de autor (C) Echipa ReactOS 2005-2015\n\
LTEXT "Drept de autor (C) Echipa ReactOS 2005-2023\n\
Christoph von Wittich (Christoph@ApiViewer.de)\n\
Gregor Schneider (Gregor.Schneider@reactos.org)\n\
Hermès BÉLUSCA - MAÏTO (hermes.belusca@sfr.fr)",
@@ -34,8 +40,8 @@ BEGIN
PUSHBUTTON "Lansează &Restaurare sistem", IDC_BTN_SYSTEM_RESTORE_START, 146, 156, 124, 14
PUSHBUTTON "E&xtindere fișier…", IDC_BTN_FILE_EXTRACTION, 275, 156, 85, 14
GROUPBOX "Moduri de pornire sistem", IDC_STATIC, 5, 5, 356, 145
LTEXT "Încarcă toate serviciile și modulele-pilot", IDC_STATIC, 25, 30, 322, 10
LTEXT "Încarcă doar modulele-pilot de bază", IDC_STATIC, 25, 58, 322, 10
LTEXT "Încarcă toate serviciile și driverele", IDC_STATIC, 25, 30, 322, 10
LTEXT "Încarcă doar driverele de bază", IDC_STATIC, 25, 58, 322, 10
END
IDD_SYSTEM_PAGE DIALOGEX 0, 0, 366, 175

View File

@@ -4,6 +4,7 @@
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2009 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2018 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -13,12 +14,12 @@ BEGIN
POPUP "&Jurnal"
BEGIN
MENUITEM "&Deschidere…", IDM_OPEN_EVENTLOG
MENUITEM "&Păstrare jurnal de evenimente ca…", IDM_SAVE_EVENTLOG
MENUITEM "&Salvează jurnal de evenimente ca…", IDM_SAVE_EVENTLOG
MENUITEM "Î&nchide", IDM_CLOSE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "Înlăt&ură toate evenimentele", IDM_CLEAR_EVENTS
MENUITEM "&Redenumire\tF2", IDM_RENAME_EVENTLOG
MENUITEM "&Configurare jurnal…", IDM_EVENTLOG_SETTINGS
MENUITEM "&Setări pentru jurnal…", IDM_EVENTLOG_SETTINGS
MENUITEM SEPARATOR
MENUITEM "I&eșire", IDM_EXIT
END
@@ -36,7 +37,7 @@ BEGIN
MENUITEM "Afișează detalii de e&venimente", IDM_EVENT_DETAILS_VIEW
MENUITEM "Afișează linii de g&rilaj", IDM_LIST_GRID_LINES
MENUITEM SEPARATOR
MENUITEM "&Păstrează configurația la ieșire", IDM_SAVE_SETTINGS
MENUITEM "&Salvează setările la ieșire", IDM_SAVE_SETTINGS
END
POPUP "Aj&utor"
BEGIN
@@ -50,12 +51,12 @@ IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM "&Deschide jurnalul de evenimente...", IDM_OPEN_EVENTLOG
MENUITEM "Salv&ează jurnalul de evenimente ca...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
MENUITEM "Șter&ge toate evenimentele", IDM_CLEAR_EVENTS
MENUITEM "&Redenumește\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Setări de &jurnal...", IDM_EVENTLOG_SETTINGS
END
END
@@ -129,7 +130,7 @@ BEGIN
EDITTEXT IDC_CREATED_LABEL, 67, 69, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL
LTEXT "Modificat:", IDC_STATIC, 7, 81, 60, 8
EDITTEXT IDC_MODIFIED_LABEL, 67, 81, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL
LTEXT "Accessat:", IDC_STATIC, 7, 93, 60, 8
LTEXT "Accesat:", IDC_STATIC, 7, 93, 60, 8
EDITTEXT IDC_ACCESSED_LABEL, 67, 93, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL
GROUPBOX "Dimensiune jurnal", IDC_STATIC, 7, 106, 238, 99
LTEXT "Dimensiune ma&ximă pentru jurnal:", IDC_STATIC, 17, 122, 58, 8
@@ -163,7 +164,7 @@ BEGIN
IDS_EVENTLOG_USER "Jurnale de utilizator"
IDS_SAVE_FILTER "Jurnal de evenimente (*.evt)\0*.evt\0"
IDS_CLEAREVENTS_MSG "Doriți păstrarea acestui jurnal de evenimente înainte de a-l închide?"
IDS_RESTOREDEFAULTS "Do you want to restore all settings for this log to their default values?"
IDS_RESTOREDEFAULTS "Doriți să restaurați toate setările pentru acest jurnal la valorile lor implicite?"
IDS_EVENTSTRINGIDNOTFOUND "Descrierea evenimentului cu ID-ul ( %lu ) în sursa ( %s ) nu a fost găsită. Este posibil ca în calculatorul local să nu existe informațiile de registru necesare sau fișierele dll de mesaje să afișeze mesaje de la un calculator din rețea.\n\nInformații aferente evenimentului:\n\n"
END

View File

@@ -1,6 +1,10 @@
/*
* Translators: Petru Dimitriu (petrimetri at gmail dot com)
* Ștefan Fulea (stefan dot fulea at mail dot com)
* PROJECT: ReactOS Service Manager
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -133,7 +137,7 @@ BEGIN
COMBOBOX IDC_SECOND_FAILURE, 104, 39, 141, 147, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST
LTEXT "Alt&e căderi:", IDC_STATIC, 7, 58, 92, 8
COMBOBOX IDC_SUBSEQUENT_FAILURES, 104, 56, 141, 147, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST
LTEXT "&Ropornire contor după:", IDC_STATIC, 7, 75, 72, 8
LTEXT "&Repornire contor după:", IDC_STATIC, 7, 75, 72, 8
EDITTEXT IDC_RESET_TIME, 104, 73, 40, 13, WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER
LTEXT "zile", IDC_STATIC, 150, 75, 95, 8
LTEXT "Repornire ser&viciu după:", IDC_RESTART_TEXT1, 7, 92, 92, 8
@@ -332,7 +336,7 @@ BEGIN
IDS_NO_ACTION "Nici o acțiune"
IDS_RESTART_SERVICE "Repornește serviciul"
IDS_RUN_PROGRAM "Execută un program"
IDS_RESTART_COMPUTER "Ropornește calculatorul"
IDS_RESTART_COMPUTER "Repornește calculatorul"
END
STRINGTABLE

View File

@@ -28,7 +28,7 @@ list(APPEND SOURCE
winproc.cpp
precomp.h)
file(GLOB mspaint_rc_deps icons/*.*)
file(GLOB mspaint_rc_deps img/*.*)
add_rc_deps(rsrc.rc ${mspaint_rc_deps})
add_executable(mspaint ${SOURCE} rsrc.rc)
set_module_type(mspaint win32gui UNICODE)

View File

@@ -69,7 +69,7 @@ public:
return TRUE;
}
HRESULT LoadDx(LPCTSTR pszFileName, float *pxDpi, float *pyDpi) throw()
HRESULT LoadDx(LPCWSTR pszFileName, float *pxDpi, float *pyDpi) throw()
{
using namespace Gdiplus;
@@ -111,7 +111,7 @@ public:
return (status == Ok ? S_OK : E_FAIL);
}
HRESULT SaveDx(LPCTSTR pszFileName, REFGUID guidFileType = GUID_NULL,
HRESULT SaveDx(LPCWSTR pszFileName, REFGUID guidFileType = GUID_NULL,
float xDpi = 0, float yDpi = 0) throw()
{
using namespace Gdiplus;
@@ -141,7 +141,7 @@ public:
CLSID clsid;
if (::IsEqualGUID(guidFileType, GUID_NULL))
{
CString strExt(PathFindExtension(pszFileName));
CStringW strExt(PathFindExtensionW(pszFileName));
clsid = FindCodecForExtension(strExt, pEncoders, cEncoders);
}
else
@@ -300,23 +300,23 @@ protected:
// CImage::FindCodecForExtension is private. We have to duplicate it at here...
static CLSID
FindCodecForExtension(LPCTSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs)
FindCodecForExtension(LPCWSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs)
{
for (UINT i = 0; i < nCodecs; ++i)
{
CString strSpecs(pCodecs[i].FilenameExtension);
CStringW strSpecs(pCodecs[i].FilenameExtension);
int ichOld = 0, ichSep;
for (;;)
{
ichSep = strSpecs.Find(TEXT(';'), ichOld);
ichSep = strSpecs.Find(L';', ichOld);
CString strSpec;
CStringW strSpec;
if (ichSep < 0)
strSpec = strSpecs.Mid(ichOld);
else
strSpec = strSpecs.Mid(ichOld, ichSep - ichOld);
int ichDot = strSpec.ReverseFind(TEXT('.'));
int ichDot = strSpec.ReverseFind(L'.');
if (ichDot >= 0)
strSpec = strSpec.Mid(ichDot);

View File

@@ -29,18 +29,6 @@ CCanvasWindow::~CCanvasWindow()
::DeleteObject(m_ahbmCached[1]);
}
VOID CCanvasWindow::drawZoomFrame(INT mouseX, INT mouseY)
{
// FIXME: Draw the border of the area that is to be zoomed in
CRect rc;
GetImageRect(rc);
ImageToCanvas(rc);
HDC hdc = GetDC();
DrawXorRect(hdc, &rc);
ReleaseDC(hdc);
}
RECT CCanvasWindow::GetBaseRect()
{
CRect rcBase;
@@ -101,31 +89,88 @@ HITTEST CCanvasWindow::CanvasHitTest(POINT pt)
return getSizeBoxHitTest(pt, &rcBase);
}
VOID CCanvasWindow::getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget)
{
CRect rcImage;
GetImageRect(rcImage);
ImageToCanvas(rcImage);
// Calculate the zoom rectangle
INT oldZoom = toolsModel.GetZoom();
GetClientRect(rcView);
LONG cxView = rcView.right * oldZoom / newZoom, cyView = rcView.bottom * oldZoom / newZoom;
::SetRect(&rcView, ptTarget.x - cxView / 2, ptTarget.y - cyView / 2,
ptTarget.x + cxView / 2, ptTarget.y + cyView / 2);
// Shift the rectangle if necessary
INT dx = 0, dy = 0;
if (rcView.left < rcImage.left)
dx = rcImage.left - rcView.left;
else if (rcImage.right < rcView.right)
dx = rcImage.right - rcView.right;
if (rcView.top < rcImage.top)
dy = rcImage.top - rcView.top;
else if (rcImage.bottom < rcView.bottom)
dy = rcImage.bottom - rcView.bottom;
rcView.OffsetRect(dx, dy);
rcView.IntersectRect(&rcView, &rcImage);
}
VOID CCanvasWindow::zoomTo(INT newZoom, LONG left, LONG top)
{
POINT pt = { left, top };
CanvasToImage(pt);
toolsModel.SetZoom(newZoom);
ImageToCanvas(pt);
pt.x += GetScrollPos(SB_HORZ);
pt.y += GetScrollPos(SB_VERT);
updateScrollRange();
updateScrollPos(pt.x, pt.y);
Invalidate(TRUE);
}
VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
{
// This is the target area we have to draw on
CRect rcCanvasDraw;
rcCanvasDraw.IntersectRect(&rcClient, &rcPaint);
// We use a memory bitmap to reduce flickering
HDC hdcMem0 = ::CreateCompatibleDC(hDC);
m_ahbmCached[0] = CachedBufferDIB(m_ahbmCached[0], rcClient.right, rcClient.bottom);
HGDIOBJ hbm0Old = ::SelectObject(hdcMem0, m_ahbmCached[0]);
// Fill the background on hdcMem0
::FillRect(hdcMem0, &rcPaint, (HBRUSH)(COLOR_APPWORKSPACE + 1));
::FillRect(hdcMem0, &rcCanvasDraw, (HBRUSH)(COLOR_APPWORKSPACE + 1));
// Draw the sizeboxes if necessary
RECT rcBase = GetBaseRect();
if (!selectionModel.m_bShow && !::IsWindowVisible(textEditWindow))
drawSizeBoxes(hdcMem0, &rcBase, FALSE, &rcPaint);
drawSizeBoxes(hdcMem0, &rcBase, FALSE, &rcCanvasDraw);
// Calculate image size
CRect rcImage;
GetImageRect(rcImage);
SIZE sizeImage = { imageModel.GetWidth(), imageModel.GetHeight() };
// Calculate the target area on the image
CRect rcImageDraw = rcCanvasDraw;
CanvasToImage(rcImageDraw);
rcImageDraw.IntersectRect(&rcImageDraw, &rcImage);
// Consider rounding down by zooming
rcImageDraw.right += 1;
rcImageDraw.bottom += 1;
// hdcMem1 <-- imageModel
HDC hdcMem1 = ::CreateCompatibleDC(hDC);
m_ahbmCached[1] = CachedBufferDIB(m_ahbmCached[1], sizeImage.cx, sizeImage.cy);
HGDIOBJ hbm1Old = ::SelectObject(hdcMem1, m_ahbmCached[1]);
BitBlt(hdcMem1, 0, 0, sizeImage.cx, sizeImage.cy, imageModel.GetDC(), 0, 0, SRCCOPY);
::BitBlt(hdcMem1, rcImageDraw.left, rcImageDraw.top, rcImageDraw.Width(), rcImageDraw.Height(),
imageModel.GetDC(), rcImageDraw.left, rcImageDraw.top, SRCCOPY);
// Draw overlay #1 on hdcMem1
toolsModel.OnDrawOverlayOnImage(hdcMem1);
@@ -170,17 +215,15 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
DrawXorRect(hdcMem0, &m_rcResizing);
// Transfer the bits (hDC <-- hdcMem0)
::BitBlt(hDC,
rcPaint.left, rcPaint.top,
rcPaint.right - rcPaint.left, rcPaint.bottom - rcPaint.top,
hdcMem0, rcPaint.left, rcPaint.top, SRCCOPY);
::BitBlt(hDC, rcCanvasDraw.left, rcCanvasDraw.top, rcCanvasDraw.Width(), rcCanvasDraw.Height(),
hdcMem0, rcCanvasDraw.left, rcCanvasDraw.top, SRCCOPY);
// Clean up hdcMem0
::SelectObject(hdcMem0, hbm0Old);
::DeleteDC(hdcMem0);
}
VOID CCanvasWindow::Update(HWND hwndFrom)
VOID CCanvasWindow::updateScrollRange()
{
CRect rcClient;
GetClientRect(&rcClient);
@@ -211,10 +254,16 @@ VOID CCanvasWindow::Update(HWND hwndFrom)
SetScrollInfo(SB_VERT, &si);
}
VOID CCanvasWindow::updateScrollPos(INT x, INT y)
{
SetScrollPos(SB_HORZ, x);
SetScrollPos(SB_VERT, y);
}
LRESULT CCanvasWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (m_hWnd)
Update(m_hWnd);
updateScrollRange();
return 0;
}
@@ -229,7 +278,7 @@ VOID CCanvasWindow::OnHVScroll(WPARAM wParam, INT fnBar)
{
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
si.nPos = HIWORD(wParam);
si.nPos = (SHORT)HIWORD(wParam);
break;
case SB_LINELEFT:
si.nPos -= 5;
@@ -244,9 +293,9 @@ VOID CCanvasWindow::OnHVScroll(WPARAM wParam, INT fnBar)
si.nPos += si.nPage;
break;
}
si.nPos = max(min(si.nPos, si.nMax), si.nMin);
SetScrollInfo(fnBar, &si);
Update(m_hWnd);
Invalidate(FALSE); // FIXME: Flicker
Invalidate();
}
LRESULT CCanvasWindow::OnHScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -261,21 +310,41 @@ LRESULT CCanvasWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
return 0;
}
LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
m_nMouseDownMsg = nMsg;
BOOL bLeftButton = (nMsg == WM_LBUTTONDOWN);
if (nMsg == WM_MBUTTONDOWN)
{
m_ptOrig = pt;
SetCapture();
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG)));
return 0;
}
HITTEST hitSelection = SelectionHitTest(pt);
if (hitSelection != HIT_NONE)
{
selectionModel.m_nSelectionBrush = 0; // Selection Brush is OFF
if (bLeftButton)
{
CanvasToImage(pt);
if (::GetKeyState(VK_CONTROL) < 0) // Ctrl+Click is Selection Clone
{
imageModel.SelectionClone();
}
else if (::GetKeyState(VK_SHIFT) < 0) // Shift+Dragging is Selection Brush
{
selectionModel.m_nSelectionBrush = 1; // Selection Brush is ON
}
StartSelectionDrag(hitSelection, pt);
}
else
{
canvasWindow.ClientToScreen(&pt);
ClientToScreen(&pt);
mainWindow.TrackPopupMenu(pt, 0);
}
return 0;
@@ -288,14 +357,14 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
{
case TOOL_BEZIER:
case TOOL_SHAPE:
toolsModel.OnCancelDraw();
canvasWindow.Invalidate();
toolsModel.OnEndDraw(TRUE);
Invalidate();
break;
case TOOL_FREESEL:
case TOOL_RECTSEL:
toolsModel.OnFinishDraw();
canvasWindow.Invalidate();
toolsModel.OnEndDraw(FALSE);
Invalidate();
break;
default:
@@ -328,45 +397,40 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
return 0;
}
LRESULT CCanvasWindow::OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDown(TRUE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDown(FALSE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnLRButtonDblClk(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CCanvasWindow::OnButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
CanvasToImage(pt);
m_drawing = FALSE;
ReleaseCapture();
::ReleaseCapture();
m_nMouseDownMsg = 0;
toolsModel.OnButtonDown(bLeftButton, pt.x, pt.y, TRUE);
toolsModel.OnButtonDown(nMsg == WM_LBUTTONDBLCLK, pt.x, pt.y, TRUE);
toolsModel.resetTool();
Invalidate(FALSE);
return 0;
}
LRESULT CCanvasWindow::OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDblClk(TRUE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDblClk(FALSE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (m_nMouseDownMsg == WM_MBUTTONDOWN)
{
INT x = GetScrollPos(SB_HORZ) - (pt.x - m_ptOrig.x);
INT y = GetScrollPos(SB_VERT) - (pt.y - m_ptOrig.y);
SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, x), 0);
SendMessage(WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, y), 0);
m_ptOrig = pt;
return 0;
}
CanvasToImage(pt);
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
Invalidate();
if (m_hitSelection != HIT_NONE)
{
SelectionDragging(pt);
@@ -375,14 +439,6 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (!m_drawing || toolsModel.GetActiveTool() <= TOOL_AIRBRUSH)
{
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
{
Invalidate(FALSE);
UpdateWindow();
CanvasToImage(pt);
drawZoomFrame(pt.x, pt.y);
}
TRACKMOUSEEVENT tme = { sizeof(tme) };
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = m_hWnd;
@@ -391,86 +447,19 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (!m_drawing)
{
CString strCoord;
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
RECT rcImage;
GetImageRect(rcImage);
CStringW strCoord;
if (::PtInRect(&rcImage, pt))
strCoord.Format(L"%ld, %ld", pt.x, pt.y);
::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord);
}
}
if (m_drawing)
{
// values displayed in statusbar
LONG xRel = pt.x - g_ptStart.x;
LONG yRel = pt.y - g_ptStart.y;
switch (toolsModel.GetActiveTool())
{
// freesel, rectsel and text tools always show numbers limited to fit into image area
case TOOL_FREESEL:
case TOOL_RECTSEL:
case TOOL_TEXT:
if (xRel < 0)
xRel = (pt.x < 0) ? -g_ptStart.x : xRel;
else if (pt.x > imageModel.GetWidth())
xRel = imageModel.GetWidth() - g_ptStart.x;
if (yRel < 0)
yRel = (pt.y < 0) ? -g_ptStart.y : yRel;
else if (pt.y > imageModel.GetHeight())
yRel = imageModel.GetHeight() - g_ptStart.y;
break;
// while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14
case TOOL_RUBBER:
case TOOL_PEN:
case TOOL_BRUSH:
case TOOL_AIRBRUSH:
case TOOL_SHAPE:
{
CString strCoord;
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
break;
}
default:
break;
}
// rectsel and shape tools always show non-negative numbers when drawing
if (toolsModel.GetActiveTool() == TOOL_RECTSEL || toolsModel.GetActiveTool() == TOOL_SHAPE)
{
if (xRel < 0)
xRel = -xRel;
if (yRel < 0)
yRel = -yRel;
}
if (wParam & MK_LBUTTON)
{
toolsModel.OnMouseMove(TRUE, pt.x, pt.y);
Invalidate(FALSE);
if ((toolsModel.GetActiveTool() >= TOOL_TEXT) || toolsModel.IsSelection())
{
CString strSize;
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
yRel = xRel;
strSize.Format(_T("%ld x %ld"), xRel, yRel);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
}
}
if (wParam & MK_RBUTTON)
{
toolsModel.OnMouseMove(FALSE, pt.x, pt.y);
Invalidate(FALSE);
if (toolsModel.GetActiveTool() >= TOOL_TEXT)
{
CString strSize;
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
yRel = xRel;
strSize.Format(_T("%ld x %ld"), xRel, yRel);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
}
}
toolsModel.DrawWithMouseTool(pt, wParam);
return 0;
}
@@ -522,9 +511,9 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
cyImage = min(MAXWORD, cyImage);
// Display new size
CString strSize;
strSize.Format(_T("%d x %d"), cxImage, cyImage);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
CStringW strSize;
strSize.Format(L"%d x %d", cxImage, cyImage);
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize);
// Dragging now... Fix the position...
CRect rcResizing = { 0, 0, cxImage, cyImage };
@@ -555,19 +544,22 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
return 0;
}
LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CCanvasWindow::OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
CanvasToImage(pt);
::ReleaseCapture();
BOOL bLeftButton = (m_nMouseDownMsg == WM_LBUTTONDOWN);
m_nMouseDownMsg = 0;
if (m_drawing)
{
m_drawing = FALSE;
toolsModel.OnButtonUp(bLeftButton, pt.x, pt.y);
Invalidate(FALSE);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L"");
return 0;
}
else if (m_hitSelection != HIT_NONE && bLeftButton)
@@ -618,21 +610,11 @@ LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam,
m_hitCanvasSizeBox = HIT_NONE;
toolsModel.resetTool(); // resets the point-buffer of the polygon and bezier functions
Update(NULL);
updateScrollRange();
Invalidate(TRUE);
return 0;
}
LRESULT CCanvasWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonUp(TRUE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonUp(FALSE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (CWaitCursor::IsWaiting())
@@ -641,6 +623,12 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
return 0;
}
if (m_nMouseDownMsg == WM_MBUTTONDOWN)
{
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG)));
return 0;
}
POINT pt;
::GetCursorPos(&pt);
ScreenToClient(&pt);
@@ -658,7 +646,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (hitSelection != HIT_NONE)
{
if (!setCursorOnSizeBox(hitSelection))
::SetCursor(::LoadCursor(NULL, IDC_SIZEALL));
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL));
return 0;
}
@@ -671,22 +659,22 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
switch (toolsModel.GetActiveTool())
{
case TOOL_FILL:
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_FILL)));
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_FILL)));
break;
case TOOL_COLOR:
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_COLOR)));
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_COLOR)));
break;
case TOOL_ZOOM:
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_ZOOM)));
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_ZOOM)));
break;
case TOOL_PEN:
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_PEN)));
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_PEN)));
break;
case TOOL_AIRBRUSH:
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_AIRBRUSH)));
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_AIRBRUSH)));
break;
default:
::SetCursor(::LoadCursor(NULL, IDC_CROSS));
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_CROSS));
}
return 0;
}
@@ -703,6 +691,7 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
{
// Cancel dragging
::ReleaseCapture();
m_nMouseDownMsg = 0;
m_hitCanvasSizeBox = HIT_NONE;
::SetRectEmpty(&m_rcResizing);
Invalidate(TRUE);
@@ -722,12 +711,12 @@ LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
LRESULT CCanvasWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return ::SendMessage(GetParent(), nMsg, wParam, lParam);
return ::SendMessageW(GetParent(), nMsg, wParam, lParam);
}
LRESULT CCanvasWindow::OnCaptureChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L"");
return 0;
}
@@ -750,17 +739,17 @@ LRESULT CCanvasWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
VOID CCanvasWindow::cancelDrawing()
{
selectionModel.ClearColor();
selectionModel.ClearMask();
selectionModel.ClearColorImage();
selectionModel.ClearMaskImage();
m_hitSelection = HIT_NONE;
m_drawing = FALSE;
toolsModel.OnCancelDraw();
toolsModel.OnEndDraw(TRUE);
Invalidate(FALSE);
}
VOID CCanvasWindow::finishDrawing()
{
toolsModel.OnFinishDraw();
toolsModel.OnEndDraw(FALSE);
m_drawing = FALSE;
Invalidate(FALSE);
}
@@ -790,6 +779,12 @@ VOID CCanvasWindow::StartSelectionDrag(HITTEST hit, POINT ptImage)
VOID CCanvasWindow::SelectionDragging(POINT ptImage)
{
if (selectionModel.m_nSelectionBrush)
{
imageModel.SelectionClone(selectionModel.m_nSelectionBrush == 1);
selectionModel.m_nSelectionBrush = 2; // Selection Brush is ON and drawn
}
selectionModel.Dragging(m_hitSelection, ptImage);
Invalidate(FALSE);
}

View File

@@ -10,7 +10,7 @@
class CCanvasWindow : public CWindowImpl<CCanvasWindow>
{
public:
DECLARE_WND_CLASS_EX(_T("ReactOSPaintCanvas"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
DECLARE_WND_CLASS_EX(L"ReactOSPaintCanvas", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
COLOR_APPWORKSPACE)
BEGIN_MSG_MAP(CCanvasWindow)
@@ -20,13 +20,15 @@ public:
MESSAGE_HANDLER(WM_HSCROLL, OnHScroll)
MESSAGE_HANDLER(WM_VSCROLL, OnVScroll)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnRButtonDblClk)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnButtonDown)
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnButtonDown)
MESSAGE_HANDLER(WM_MBUTTONDOWN, OnButtonDown)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnButtonDblClk)
MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnButtonDblClk)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
MESSAGE_HANDLER(WM_LBUTTONUP, OnButtonUp)
MESSAGE_HANDLER(WM_RBUTTONUP, OnButtonUp)
MESSAGE_HANDLER(WM_MBUTTONUP, OnButtonUp)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel)
MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode)
@@ -42,7 +44,8 @@ public:
VOID cancelDrawing();
VOID finishDrawing();
VOID Update(HWND hwndFrom);
VOID updateScrollRange();
VOID updateScrollPos(INT x = 0, INT y = 0);
VOID ImageToCanvas(POINT& pt);
VOID ImageToCanvas(RECT& rc);
@@ -50,6 +53,8 @@ public:
VOID CanvasToImage(RECT& rc, BOOL bZoomed = FALSE);
VOID GetImageRect(RECT& rc);
VOID MoveSelection(INT xDelta, INT yDelta);
VOID getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget);
VOID zoomTo(INT newZoom, LONG left = 0, LONG top = 0);
protected:
HITTEST m_hitSelection;
@@ -62,7 +67,6 @@ protected:
RECT GetBaseRect();
VOID DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint);
VOID OnHVScroll(WPARAM wParam, INT fnBar);
VOID drawZoomFrame(INT mouseX, INT mouseY);
HITTEST SelectionHitTest(POINT ptImage);
VOID StartSelectionDrag(HITTEST hit, POINT ptImage);
@@ -74,14 +78,8 @@ protected:
LRESULT OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnEraseBkgnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
@@ -89,7 +87,8 @@ protected:
LRESULT OnCtlColorEdit(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPaletteModelColorChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLRButtonDblClk(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
UINT m_nMouseDownMsg = 0;
LRESULT OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};

View File

@@ -43,8 +43,17 @@ enum HITTEST // hit
/* FUNCTIONS ********************************************************/
BOOL zoomTo(int newZoom, int mouseX, int mouseY);
void ShowOutOfMemory(void);
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
void updateStartAndLast(LONG x, LONG y);
void updateLast(LONG x, LONG y);
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
#define DEG2RAD(degree) (((degree) * M_PI) / 180)
#define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI))
template <typename T>
inline void Swap(T& a, T& b)
{
T tmp = a;
a = b;
b = tmp;
}

View File

@@ -113,22 +113,21 @@ LRESULT CAttributesDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam,
if (g_isAFile)
{
TCHAR date[100];
TCHAR temp[100];
GetDateFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date));
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp));
_tcscat(date, _T(" "));
_tcscat(date, temp);
CString strSize;
WCHAR date[100], temp[100];
GetDateFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date));
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp));
StringCchCatW(date, _countof(date), L" ");
StringCchCatW(date, _countof(date), temp);
CStringW strSize;
strSize.Format(IDS_FILESIZE, g_fileSize);
SetDlgItemText(IDD_ATTRIBUTESTEXT6, date);
SetDlgItemText(IDD_ATTRIBUTESTEXT7, strSize);
}
CString strUnit;
CStringW strUnit;
GetDlgItemText(IDD_ATTRIBUTESTEXT8, strUnit);
CString strRes;
CStringW strRes;
if (strUnit == L"dpi")
strRes.Format(IDS_PRINTRES, ROUND(g_xDpi), ROUND(g_yDpi));
else
@@ -173,10 +172,10 @@ LRESULT CAttributesDialog::OnRadioButton1(WORD wNotifyCode, WORD wID, HWND hWndC
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1) != BST_CHECKED)
return 0;
CString strNum;
strNum.Format(_T("%.3lf"), newWidth / g_xDpi);
CStringW strNum;
strNum.Format(L"%.3lf", newWidth / g_xDpi);
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
strNum.Format(_T("%.3lf"), newHeight / g_yDpi);
strNum.Format(L"%.3lf", newHeight / g_yDpi);
SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum);
return 0;
}
@@ -186,10 +185,10 @@ LRESULT CAttributesDialog::OnRadioButton2(WORD wNotifyCode, WORD wID, HWND hWndC
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2) != BST_CHECKED)
return 0;
CString strNum;
strNum.Format(_T("%.3lf"), newWidth / PpcmFromDpi(g_xDpi));
CStringW strNum;
strNum.Format(L"%.3lf", newWidth / PpcmFromDpi(g_xDpi));
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
strNum.Format(_T("%.3lf"), newHeight / PpcmFromDpi(g_yDpi));
strNum.Format(L"%.3lf", newHeight / PpcmFromDpi(g_yDpi));
SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum);
return 0;
}
@@ -208,21 +207,21 @@ LRESULT CAttributesDialog::OnEdit1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
{
if (Edit_GetModify(hWndCtl))
{
TCHAR tempS[100];
WCHAR tempS[100];
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
newWidth = max(1, (int) (_tcstod(tempS, NULL) * g_xDpi));
newWidth = max(1, (int)(wcstod(tempS, NULL) * g_xDpi));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
newWidth = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_xDpi)));
newWidth = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_xDpi)));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
newWidth = max(1, _tstoi(tempS));
newWidth = max(1, _wtoi(tempS));
}
Edit_SetModify(hWndCtl, FALSE);
}
@@ -233,21 +232,21 @@ LRESULT CAttributesDialog::OnEdit2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
{
if (Edit_GetModify(hWndCtl))
{
TCHAR tempS[100];
WCHAR tempS[100];
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
newHeight = max(1, (int) (_tcstod(tempS, NULL) * g_yDpi));
newHeight = max(1, (int)(wcstod(tempS, NULL) * g_yDpi));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
newHeight = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_yDpi)));
newHeight = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_yDpi)));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
newHeight = max(1, _tstoi(tempS));
newHeight = max(1, _wtoi(tempS));
}
Edit_SetModify(hWndCtl, FALSE);
}
@@ -273,9 +272,7 @@ LRESULT CStretchSkewDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
LRESULT CStretchSkewDialog::OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
CString strrcIntNumbers;
CString strrcPercentage;
CString strrcAngle;
CStringW strrcIntNumbers, strrcPercentage, strrcAngle;
BOOL tr1, tr2, tr3, tr4;
strrcIntNumbers.LoadString(g_hinstExe, IDS_INTNUMBERS);
@@ -305,11 +302,11 @@ LRESULT CStretchSkewDialog::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, B
}
static INT CALLBACK
EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, INT FontType, LPARAM lParam)
EnumFontFamProc(ENUMLOGFONTW *lpelf, NEWTEXTMETRICW *lpntm, INT FontType, LPARAM lParam)
{
CSimpleArray<CString>& arrFontNames = *reinterpret_cast<CSimpleArray<CString>*>(lParam);
LPTSTR name = lpelf->elfLogFont.lfFaceName;
if (name[0] == TEXT('@')) // Vertical fonts
CSimpleArray<CStringW>& arrFontNames = *reinterpret_cast<CSimpleArray<CStringW>*>(lParam);
LPWSTR name = lpelf->elfLogFont.lfFaceName;
if (name[0] == L'@') // Vertical fonts
return TRUE;
for (INT i = 0; i < arrFontNames.GetSize(); ++i)
@@ -331,24 +328,24 @@ CFontsDialog::CFontsDialog()
void CFontsDialog::InitFontNames()
{
// List the fonts
CSimpleArray<CString> arrFontNames;
CSimpleArray<CStringW> arrFontNames;
HDC hDC = CreateCompatibleDC(NULL);
if (hDC)
{
EnumFontFamilies(hDC, NULL, (FONTENUMPROC)EnumFontFamProc,
reinterpret_cast<LPARAM>(&arrFontNames));
DeleteDC(hDC);
EnumFontFamiliesW(hDC, NULL, (FONTENUMPROCW)EnumFontFamProc,
reinterpret_cast<LPARAM>(&arrFontNames));
::DeleteDC(hDC);
}
// Actually add them to the combobox
HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
SendMessage(hwndNames, CB_RESETCONTENT, 0, 0);
::SendMessageW(hwndNames, CB_RESETCONTENT, 0, 0);
for (INT i = 0; i < arrFontNames.GetSize(); ++i)
{
ComboBox_AddString(hwndNames, arrFontNames[i]);
}
::SetWindowText(hwndNames, registrySettings.strFontName);
::SetWindowTextW(hwndNames, registrySettings.strFontName);
}
void CFontsDialog::InitFontSizes()
@@ -361,10 +358,10 @@ void CFontsDialog::InitFontSizes()
HWND hwndSizes = GetDlgItem(IDD_FONTSSIZES);
ComboBox_ResetContent(hwndSizes);
TCHAR szText[16];
WCHAR szText[16];
for (UINT i = 0; i < _countof(s_sizes); ++i)
{
wsprintf(szText, TEXT("%d"), s_sizes[i]);
StringCchPrintfW(szText, _countof(szText), L"%d", s_sizes[i]);
INT iItem = ComboBox_AddString(hwndSizes, szText);
if (s_sizes[i] == (INT)registrySettings.PointSize)
ComboBox_SetCurSel(hwndSizes, iItem);
@@ -372,27 +369,27 @@ void CFontsDialog::InitFontSizes()
if (ComboBox_GetCurSel(hwndSizes) == CB_ERR)
{
wsprintf(szText, TEXT("%d"), (INT)registrySettings.PointSize);
::SetWindowText(hwndSizes, szText);
StringCchPrintfW(szText, _countof(szText), L"%d", (INT)registrySettings.PointSize);
::SetWindowTextW(hwndSizes, szText);
}
}
void CFontsDialog::InitToolbar()
{
HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
SendMessage(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
SendMessage(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
::SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
::SendMessageW(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
::SendMessageW(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
TBADDBITMAP AddBitmap;
AddBitmap.hInst = g_hinstExe;
AddBitmap.nID = IDB_FONTSTOOLBAR;
SendMessage(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
::SendMessageW(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCE(IDB_FONTSTOOLBAR),
HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCEW(IDB_FONTSTOOLBAR),
16, 8, RGB(255, 0, 255), IMAGE_BITMAP,
LR_CREATEDIBSECTION);
SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
::SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
TBBUTTON buttons[] =
{
@@ -401,11 +398,11 @@ void CFontsDialog::InitToolbar()
{ 2, IDM_UNDERLINE, TBSTATE_ENABLED, TBSTYLE_CHECK },
{ 3, IDM_VERTICAL, 0, TBSTYLE_CHECK }, // TODO:
};
SendMessage(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons);
::SendMessageW(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons);
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold);
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic);
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline);
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold);
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic);
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline);
}
LRESULT CFontsDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -441,7 +438,7 @@ void CFontsDialog::OnFontName(UINT codeNotify)
HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
INT iItem = CB_ERR;
UINT cch;
TCHAR szText[LF_FACESIZE];
WCHAR szText[LF_FACESIZE];
switch (codeNotify)
{
@@ -449,9 +446,7 @@ void CFontsDialog::OnFontName(UINT codeNotify)
iItem = ComboBox_GetCurSel(hwndNames);
cch = ComboBox_GetLBTextLen(hwndNames, iItem);
if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
{
ComboBox_GetLBText(hwndNames, iItem, szText);
}
break;
case CBN_EDITCHANGE:
@@ -482,13 +477,13 @@ void CFontsDialog::OnFontSize(UINT codeNotify)
if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
{
ComboBox_GetLBText(hwndSizes, iItem, szText);
PointSize = _ttoi(szText);
PointSize = _wtoi(szText);
}
break;
case CBN_EDITCHANGE:
::GetWindowText(hwndSizes, szText, _countof(szText));
PointSize = _ttoi(szText);
::GetWindowTextW(hwndSizes, szText, _countof(szText));
PointSize = _wtoi(szText);
break;
}
@@ -504,7 +499,7 @@ LRESULT CFontsDialog::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
UINT id = LOWORD(wParam);
UINT codeNotify = HIWORD(wParam);
HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
BOOL bChecked = ::SendMessage(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
BOOL bChecked = (BOOL)::SendMessageW(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
switch (id)
{
@@ -548,14 +543,14 @@ LRESULT CFontsDialog::OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
NMHDR *pnmhdr = reinterpret_cast<NMHDR *>(lParam);
if (pnmhdr->code == TTN_NEEDTEXT)
{
LPTOOLTIPTEXT pToolTip = reinterpret_cast<LPTOOLTIPTEXT>(lParam);
LPTOOLTIPTEXTW pToolTip = reinterpret_cast<LPTOOLTIPTEXTW>(lParam);
pToolTip->hinst = g_hinstExe;
switch (pnmhdr->idFrom)
{
case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCE(IDS_BOLD); break;
case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCE(IDS_ITALIC); break;
case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCE(IDS_UNDERLINE); break;
case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCE(IDS_VERTICAL); break;
case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_BOLD); break;
case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_ITALIC); break;
case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_UNDERLINE); break;
case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_VERTICAL); break;
default:
break;
@@ -604,29 +599,29 @@ LRESULT CFontsDialog::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
if (pDrawItem->itemID == (UINT)-1)
return TRUE;
SetBkMode(pDrawItem->hDC, TRANSPARENT);
::SetBkMode(pDrawItem->hDC, TRANSPARENT);
HWND hwndItem = pDrawItem->hwndItem;
RECT rcItem = pDrawItem->rcItem;
if (pDrawItem->itemState & ODS_SELECTED)
{
FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
else
{
FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT));
::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT));
}
TCHAR szText[LF_FACESIZE];
WCHAR szText[LF_FACESIZE];
if ((UINT)ComboBox_GetLBTextLen(hwndItem, pDrawItem->itemID) < _countof(szText))
{
szText[0] = 0;
ComboBox_GetLBText(hwndItem, pDrawItem->itemID, szText);
rcItem.left += 24;
DrawText(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
::DrawTextW(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
}
if (pDrawItem->itemState & ODS_FOCUS)

View File

@@ -6,7 +6,6 @@
*/
#include "precomp.h"
#include <math.h>
INT g_fileSize = 0;
float g_xDpi = 96;
@@ -88,7 +87,7 @@ CreateColorDIB(int width, int height, COLORREF rgb)
HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy)
{
BITMAP bm;
if (!GetObject(hbm, sizeof(bm), &bm))
if (!::GetObjectW(hbm, sizeof(bm), &bm))
return NULL;
if (cx == 0 || cy == 0)
@@ -97,19 +96,19 @@ HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy)
cy = bm.bmHeight;
}
HBITMAP hbmNew = CreateBitmap(cx, cy, 1, 1, NULL);
HBITMAP hbmNew = ::CreateBitmap(cx, cy, 1, 1, NULL);
if (!hbmNew)
return NULL;
HDC hdc1 = CreateCompatibleDC(NULL);
HDC hdc2 = CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = SelectObject(hdc1, hbm);
HGDIOBJ hbm2Old = SelectObject(hdc2, hbmNew);
StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
SelectObject(hdc1, hbm1Old);
SelectObject(hdc2, hbm2Old);
DeleteDC(hdc1);
DeleteDC(hdc2);
HDC hdc1 = ::CreateCompatibleDC(NULL);
HDC hdc2 = ::CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = ::SelectObject(hdc1, hbm);
HGDIOBJ hbm2Old = ::SelectObject(hdc2, hbmNew);
::StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
::SelectObject(hdc1, hbm1Old);
::SelectObject(hdc2, hbm2Old);
::DeleteDC(hdc1);
::DeleteDC(hdc2);
return hbmNew;
}
@@ -121,7 +120,7 @@ HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight)
minimalHeight = 1;
BITMAP bm;
if (!GetObject(hbm, sizeof(bm), &bm))
if (!GetObjectW(hbm, sizeof(bm), &bm))
hbm = NULL;
if (hbm && minimalWidth <= bm.bmWidth && minimalHeight <= bm.bmHeight)
@@ -137,7 +136,7 @@ int
GetDIBWidth(HBITMAP hBitmap)
{
BITMAP bm;
GetObject(hBitmap, sizeof(BITMAP), &bm);
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
return bm.bmWidth;
}
@@ -145,7 +144,7 @@ int
GetDIBHeight(HBITMAP hBitmap)
{
BITMAP bm;
GetObject(hBitmap, sizeof(BITMAP), &bm);
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
return bm.bmHeight;
}
@@ -212,8 +211,8 @@ void SetFileInfo(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isAFile)
}
// set title
CString strTitle;
strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName));
CStringW strTitle;
strTitle.Format(IDS_WINDOWTITLE, PathFindFileNameW(g_szFileName));
mainWindow.SetWindowText(strTitle);
// update file info and recent
@@ -229,11 +228,14 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
COLORREF white = RGB(255, 255, 255);
HBITMAP hBitmap = CreateColorDIB(registrySettings.BMPWidth, registrySettings.BMPHeight, white);
if (hBitmap == NULL)
{
ShowOutOfMemory();
return NULL;
}
HDC hScreenDC = ::GetDC(NULL);
g_xDpi = ::GetDeviceCaps(hScreenDC, LOGPIXELSX);
g_yDpi = ::GetDeviceCaps(hScreenDC, LOGPIXELSY);
g_xDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSX);
g_yDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSY);
::ReleaseDC(NULL, hScreenDC);
return SetBitmapAndInfo(hBitmap, name, pFound, isFile);
@@ -242,6 +244,7 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
{
// update image
canvasWindow.updateScrollPos();
imageModel.PushImageForUndo(hBitmap);
imageModel.ClearHistory();
@@ -255,7 +258,7 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
CWaitCursor waitCursor;
// find the file
WIN32_FIND_DATA find;
WIN32_FIND_DATAW find;
HANDLE hFind = ::FindFirstFileW(name, &find);
if (hFind == INVALID_HANDLE_VALUE) // does not exist
{
@@ -275,8 +278,14 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
CImageDx img;
float xDpi = 0, yDpi = 0;
HRESULT hr = img.LoadDx(name, &xDpi, &yDpi);
if (FAILED(hr) && fIsMainFile)
{
imageModel.ClearHistory();
hr = img.LoadDx(name, &xDpi, &yDpi);
}
if (FAILED(hr))
{
ATLTRACE("hr: 0x%08lX\n", hr);
ShowError(IDS_LOADERRORTEXT, name);
return NULL;
}
@@ -288,8 +297,8 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
if (xDpi <= 0 || yDpi <= 0)
{
HDC hDC = ::GetDC(NULL);
xDpi = ::GetDeviceCaps(hDC, LOGPIXELSX);
yDpi = ::GetDeviceCaps(hDC, LOGPIXELSY);
xDpi = (float)::GetDeviceCaps(hDC, LOGPIXELSX);
yDpi = (float)::GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(NULL, hDC);
}
@@ -339,10 +348,6 @@ HBITMAP Rotate90DegreeBlt(HDC hDC1, INT cx, INT cy, BOOL bRight, BOOL bMono)
return hbm2;
}
#ifndef M_PI
#define M_PI 3.14159265
#endif
HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
{
CWaitCursor waitCursor;
@@ -353,7 +358,7 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
const double eTan = tan(abs(nDegree) * M_PI / 180);
BITMAP bm;
GetObjectW(hbm, sizeof(bm), &bm);
::GetObjectW(hbm, sizeof(bm), &bm);
INT cx = bm.bmWidth, cy = bm.bmHeight, dx = 0, dy = 0;
if (bVertical)
dy = INT(cx * eTan);
@@ -379,9 +384,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
{
INT delta = INT(x * eTan);
if (nDegree > 0)
BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
::BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
else
BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
::BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
}
}
else
@@ -390,9 +395,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
{
INT delta = INT(y * eTan);
if (nDegree > 0)
BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
::BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
else
BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
::BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
}
}
@@ -401,6 +406,39 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
return hbmNew;
}
HBITMAP getSubImage(HBITMAP hbmWhole, const RECT& rcPartial)
{
CRect rc = rcPartial;
HBITMAP hbmPart = CreateDIBWithProperties(rc.Width(), rc.Height());
if (!hbmPart)
return NULL;
HDC hDC1 = ::CreateCompatibleDC(NULL);
HDC hDC2 = ::CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = ::SelectObject(hDC1, hbmWhole);
HGDIOBJ hbm2Old = ::SelectObject(hDC2, hbmPart);
::BitBlt(hDC2, 0, 0, rc.Width(), rc.Height(), hDC1, rc.left, rc.top, SRCCOPY);
::SelectObject(hDC1, hbm1Old);
::SelectObject(hDC2, hbm2Old);
::DeleteDC(hDC1);
::DeleteDC(hDC2);
return hbmPart;
}
void putSubImage(HBITMAP hbmWhole, const RECT& rcPartial, HBITMAP hbmPart)
{
CRect rc = rcPartial;
HDC hDC1 = ::CreateCompatibleDC(NULL);
HDC hDC2 = ::CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = ::SelectObject(hDC1, hbmWhole);
HGDIOBJ hbm2Old = ::SelectObject(hDC2, hbmPart);
::BitBlt(hDC1, rc.left, rc.top, rc.Width(), rc.Height(), hDC2, 0, 0, SRCCOPY);
::SelectObject(hDC1, hbm1Old);
::SelectObject(hDC2, hbm2Old);
::DeleteDC(hDC1);
::DeleteDC(hDC2);
}
struct BITMAPINFODX : BITMAPINFO
{
RGBQUAD bmiColorsAdditional[256 - 1];
@@ -411,7 +449,7 @@ HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap)
CWaitCursor waitCursor;
BITMAP bm;
if (!GetObject(hBitmap, sizeof(BITMAP), &bm))
if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm))
return NULL;
BITMAPINFODX bmi;
@@ -595,7 +633,7 @@ HBITMAP ConvertToBlackAndWhite(HBITMAP hbm)
CWaitCursor waitCursor;
BITMAP bm;
if (!::GetObject(hbm, sizeof(bm), &bm))
if (!::GetObjectW(hbm, sizeof(bm), &bm))
return NULL;
BITMAPINFOEX bmi;

View File

@@ -44,3 +44,5 @@ float PpcmFromDpi(float dpi);
HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap);
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal);
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF);
HBITMAP getSubImage(HBITMAP hbmWhole, const RECT& rcPartial);
void putSubImage(HBITMAP hbmWhole, const RECT& rcPartial, HBITMAP hbmPart);

View File

@@ -17,6 +17,7 @@ Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness)
HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
SetPixelV(hdc, x2, y2, color);
DeleteObject(SelectObject(hdc, oldPen));
}
@@ -115,7 +116,7 @@ Fill(HDC hdc, LONG x, LONG y, COLORREF color)
void
Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
{
LONG b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
LONG b = max(1, max(labs(x2 - x1), labs(y2 - y1)));
HBRUSH hbr = ::CreateSolidBrush(color);
for (LONG a = 0; a <= b; a++)
@@ -132,7 +133,7 @@ Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
void
Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
{
LONG b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
LONG b = max(1, max(labs(x2 - x1), labs(y2 - y1)));
for (LONG a = 0; a <= b; a++)
{
@@ -164,73 +165,66 @@ Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
}
void
Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style, INT thickness)
{
HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
HBRUSH oldBrush = (HBRUSH) SelectObject(hdc, CreateSolidBrush(color));
LONG a, b;
b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
switch (style)
if (thickness <= 1)
{
case 0:
for(a = 0; a <= b; a++)
Ellipse(hdc, (x1 * (b - a) + x2 * a) / b - 3, (y1 * (b - a) + y2 * a) / b - 3,
(x1 * (b - a) + x2 * a) / b + 4, (y1 * (b - a) + y2 * a) / b + 4);
break;
case 1:
for(a = 0; a <= b; a++)
Ellipse(hdc,
(x1 * (b - a) + x2 * a) / b - 2,
(y1 * (b - a) + y2 * a) / b - 2,
(x1 * (b - a) + x2 * a) / b + 2,
(y1 * (b - a) + y2 * a) / b + 2);
break;
case 2:
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
::SetPixelV(hdc, x2, y2, color);
break;
case 3:
for(a = 0; a <= b; a++)
Rectangle(hdc,
(x1 * (b - a) + x2 * a) / b - 4,
(y1 * (b - a) + y2 * a) / b - 4,
(x1 * (b - a) + x2 * a) / b + 4,
(y1 * (b - a) + y2 * a) / b + 4);
break;
case 4:
for(a = 0; a <= b; a++)
Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 2, (y1 * (b - a) + y2 * a) / b - 2,
(x1 * (b - a) + x2 * a) / b + 3, (y1 * (b - a) + y2 * a) / b + 3);
break;
case 5:
for(a = 0; a <= b; a++)
Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 1, (y1 * (b - a) + y2 * a) / b - 1,
(x1 * (b - a) + x2 * a) / b + 1, (y1 * (b - a) + y2 * a) / b + 1);
break;
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
Line(hdc, x1, y1, x2, y2, color, thickness);
}
else
{
LONG a, b = max(1, max(labs(x2 - x1), labs(y2 - y1)));
switch ((BrushStyle)style)
{
POINT offsTop[] = {{3, -3}, {2, -2}, {0, 0},
{-4, -4}, {-2, -2}, {-1, 0}};
POINT offsBtm[] = {{-3, 3}, {-2, 2}, {-1, 1},
{3, 3}, {2, 2}, {0, 1}};
LONG idx = style - 6;
POINT pts[4];
pts[0].x = x1 + offsTop[idx].x;
pts[0].y = y1 + offsTop[idx].y;
pts[1].x = x1 + offsBtm[idx].x;
pts[1].y = y1 + offsBtm[idx].y;
pts[2].x = x2 + offsBtm[idx].x;
pts[2].y = y2 + offsBtm[idx].y;
pts[3].x = x2 + offsTop[idx].x;
pts[3].y = y2 + offsTop[idx].y;
Polygon(hdc, pts, 4);
break;
case BrushStyleRound:
for (a = 0; a <= b; a++)
{
Ellipse(hdc,
(x1 * (b - a) + x2 * a) / b - (thickness / 2),
(y1 * (b - a) + y2 * a) / b - (thickness / 2),
(x1 * (b - a) + x2 * a) / b + (thickness / 2),
(y1 * (b - a) + y2 * a) / b + (thickness / 2));
}
break;
case BrushStyleSquare:
for (a = 0; a <= b; a++)
{
Rectangle(hdc,
(x1 * (b - a) + x2 * a) / b - (thickness / 2),
(y1 * (b - a) + y2 * a) / b - (thickness / 2),
(x1 * (b - a) + x2 * a) / b + (thickness / 2),
(y1 * (b - a) + y2 * a) / b + (thickness / 2));
}
break;
case BrushStyleForeSlash:
case BrushStyleBackSlash:
{
POINT offsetTop, offsetBottom;
if ((BrushStyle)style == BrushStyleForeSlash)
{
offsetTop = { (thickness - 1) / 2, -(thickness - 1) / 2 };
offsetBottom = { -thickness / 2, thickness / 2 };
}
else
{
offsetTop = { -thickness / 2, -thickness / 2 };
offsetBottom = { (thickness - 1) / 2, (thickness - 1) / 2 };
}
POINT points[4] =
{
{ x1 + offsetTop.x, y1 + offsetTop.y },
{ x1 + offsetBottom.x, y1 + offsetBottom.y },
{ x2 + offsetBottom.x, y2 + offsetBottom.y },
{ x2 + offsetTop.x, y2 + offsetTop.y },
};
Polygon(hdc, points, _countof(points));
break;
}
}
}
DeleteObject(SelectObject(hdc, oldBrush));
@@ -259,38 +253,37 @@ RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
}
void
Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style)
Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style)
{
INT iSaveDC = SaveDC(hdc); // We will modify the clipping region. Save now.
INT iSaveDC = ::SaveDC(hdc); // We will modify the clipping region. Save now.
RECT rc;
SetRect(&rc, x1, y1, x2, y2);
::SetRect(&rc, x1, y1, x2, y2);
if (style == 0) // Transparent
{
SetBkMode(hdc, TRANSPARENT);
GetBkColor(hdc);
::SetBkMode(hdc, TRANSPARENT);
}
else // Opaque
{
SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, bg);
::SetBkMode(hdc, OPAQUE);
::SetBkColor(hdc, bg);
HBRUSH hbr = CreateSolidBrush(bg);
FillRect(hdc, &rc, hbr); // Fill the background
DeleteObject(hbr);
HBRUSH hbr = ::CreateSolidBrush(bg);
::FillRect(hdc, &rc, hbr); // Fill the background
::DeleteObject(hbr);
}
IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
HGDIOBJ hFontOld = SelectObject(hdc, font);
SetTextColor(hdc, fg);
HGDIOBJ hFontOld = ::SelectObject(hdc, font);
::SetTextColor(hdc, fg);
const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP |
DT_EXPANDTABS | DT_WORDBREAK;
DrawText(hdc, lpchText, -1, &rc, uFormat);
SelectObject(hdc, hFontOld);
::DrawTextW(hdc, lpchText, -1, &rc, uFormat);
::SelectObject(hdc, hFontOld);
RestoreDC(hdc, iSaveDC); // Restore
::RestoreDC(hdc, iSaveDC); // Restore
}
BOOL

View File

@@ -27,11 +27,11 @@ void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r);
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style);
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style, INT thickness);
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style);
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style);
BOOL
ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,

View File

@@ -22,8 +22,8 @@ HWND CFullscreenWindow::DoCreate()
LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
return 0;
}
@@ -44,7 +44,7 @@ LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
INT cyDest = imageModel.GetHeight();
INT xDest = (rcWnd.right - rcWnd.left - cxDest) / 2;
INT yDest = (rcWnd.bottom - rcWnd.top - cyDest) / 2;
BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
::BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
EndPaint(&ps);
return 0;
}

View File

@@ -10,7 +10,7 @@
class CFullscreenWindow : public CWindowImpl<CFullscreenWindow>
{
public:
DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
DECLARE_WND_CLASS_EX(L"FullscreenWindow", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
COLOR_BACKGROUND)
BEGIN_MSG_MAP(CFullscreenWindow)

View File

@@ -11,11 +11,9 @@
extern BOOL g_askBeforeEnlarging;
extern POINT g_ptStart, g_ptEnd;
extern HINSTANCE g_hinstExe;
extern TCHAR g_szFileName[MAX_LONG_PATH];
extern WCHAR g_szFileName[MAX_LONG_PATH];
extern BOOL g_isAFile;
extern BOOL g_imageSaved;
extern BOOL g_showGrid;

View File

@@ -12,12 +12,24 @@ ImageModel imageModel;
/* FUNCTIONS ********************************************************/
void IMAGE_PART::clear()
{
::DeleteObject(m_hbmImage);
m_hbmImage = NULL;
m_rcPart.SetRectEmpty();
m_bPartial = FALSE;
}
void ImageModel::NotifyImageChanged()
{
if (canvasWindow.IsWindow())
canvasWindow.Invalidate(FALSE);
{
canvasWindow.updateScrollRange();
canvasWindow.Invalidate();
}
if (miniature.IsWindow())
miniature.Invalidate(FALSE);
miniature.Invalidate();
}
ImageModel::ImageModel()
@@ -26,23 +38,37 @@ ImageModel::ImageModel()
, m_undoSteps(0)
, m_redoSteps(0)
{
ZeroMemory(m_hBms, sizeof(m_hBms));
ZeroMemory(m_historyItems, sizeof(m_historyItems));
m_hBms[0] = CreateColorDIB(1, 1, RGB(255, 255, 255));
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[0]);
m_hbmMaster = CreateColorDIB(1, 1, RGB(255, 255, 255));
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hbmMaster);
g_imageSaved = TRUE;
}
ImageModel::~ImageModel()
{
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
::DeleteDC(m_hDrawingDC);
::DeleteObject(m_hbmMaster);
ClearHistory();
}
for (size_t i = 0; i < HISTORYSIZE; ++i)
void ImageModel::SwapPart()
{
IMAGE_PART& part = m_historyItems[m_currInd];
if (!part.m_bPartial)
{
if (m_hBms[i])
::DeleteObject(m_hBms[i]);
Swap(m_hbmMaster, part.m_hbmImage);
return;
}
HBITMAP hbmMaster = LockBitmap();
HBITMAP hbmPart = getSubImage(hbmMaster, part.m_rcPart);
putSubImage(hbmMaster, part.m_rcPart, part.m_hbmImage);
::DeleteObject(part.m_hbmImage);
part.m_hbmImage = hbmPart;
UnlockBitmap(hbmMaster);
}
void ImageModel::Undo(BOOL bClearRedo)
@@ -53,9 +79,10 @@ void ImageModel::Undo(BOOL bClearRedo)
selectionModel.HideSelection();
// Select previous item
m_currInd = (m_currInd + HISTORYSIZE - 1) % HISTORYSIZE;
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
m_currInd = (m_currInd + HISTORYSIZE - 1) % HISTORYSIZE; // Go previous
ATLASSERT(m_hbmMaster != NULL);
SwapPart();
::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
m_undoSteps--;
if (bClearRedo)
@@ -74,9 +101,10 @@ void ImageModel::Redo()
selectionModel.HideSelection();
// Select next item
m_currInd = (m_currInd + 1) % HISTORYSIZE;
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
ATLASSERT(m_hbmMaster != NULL);
SwapPart();
m_currInd = (m_currInd + 1) % HISTORYSIZE; // Go next
::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
m_redoSteps--;
if (m_undoSteps < HISTORYSIZE - 1)
@@ -85,33 +113,67 @@ void ImageModel::Redo()
NotifyImageChanged();
}
void ImageModel::ResetToPrevious()
{
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
// Revert current item with previous item
::DeleteObject(m_hBms[m_currInd]);
m_hBms[m_currInd] = CopyDIBImage(m_hBms[(m_currInd + HISTORYSIZE - 1) % HISTORYSIZE]);
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
NotifyImageChanged();
}
void ImageModel::ClearHistory()
{
for (int i = 0; i < HISTORYSIZE; ++i)
{
m_historyItems[i].clear();
}
m_undoSteps = 0;
m_redoSteps = 0;
}
void ImageModel::PushImageForUndo()
{
HBITMAP hbm = CopyBitmap();
if (hbm == NULL)
{
ShowOutOfMemory();
return;
}
PushImageForUndo(hbm);
}
void ImageModel::PushImageForUndo(HBITMAP hbm)
{
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
// Go to the next item with an HBITMAP or current item
::DeleteObject(m_hBms[(m_currInd + 1) % HISTORYSIZE]);
m_hBms[(m_currInd + 1) % HISTORYSIZE] = (hbm ? hbm : CopyDIBImage(m_hBms[m_currInd]));
m_currInd = (m_currInd + 1) % HISTORYSIZE;
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
if (hbm == NULL)
{
ShowOutOfMemory();
return;
}
IMAGE_PART& part = m_historyItems[m_currInd];
part.clear();
part.m_hbmImage = m_hbmMaster;
m_hbmMaster = hbm;
::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
PushDone();
}
void ImageModel::PushImageForUndo(const RECT& rcPartial)
{
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
IMAGE_PART& part = m_historyItems[m_currInd];
part.clear();
part.m_bPartial = TRUE;
part.m_rcPart = rcPartial;
HBITMAP hbmMaster = LockBitmap();
part.m_hbmImage = getSubImage(hbmMaster, rcPartial);
UnlockBitmap(hbmMaster);
PushDone();
}
void ImageModel::PushDone()
{
m_currInd = (m_currInd + 1) % HISTORYSIZE; // Go next
if (m_undoSteps < HISTORYSIZE - 1)
m_undoSteps++;
@@ -129,37 +191,29 @@ void ImageModel::Crop(int nWidth, int nHeight, int nOffsetX, int nOffsetY)
if (nHeight <= 0)
nHeight = 1;
// Create an HBITMAP
HBITMAP hbmCropped = CreateDIBWithProperties(nWidth, nHeight);
if (!hbmCropped)
// Create a white HBITMAP
HBITMAP hbmNew = CreateColorDIB(nWidth, nHeight, RGB(255, 255, 255));
if (!hbmNew)
{
ShowOutOfMemory();
return;
}
// Select the HBITMAP by memory DC
HDC hdcMem = ::CreateCompatibleDC(m_hDrawingDC);
HGDIOBJ hbmOld = ::SelectObject(hdcMem, hbmCropped);
// Fill background of the HBITMAP
RECT rcBack = { 0, 0, nWidth, nHeight };
HBRUSH hbrBack = ::CreateSolidBrush(paletteModel.GetBgColor());
::FillRect(hdcMem, &rcBack, hbrBack);
::DeleteObject(hbrBack);
// Copy the old content
::BitBlt(hdcMem, -nOffsetX, -nOffsetY, GetWidth(), GetHeight(), m_hDrawingDC, 0, 0, SRCCOPY);
// Clean up
::SelectObject(hdcMem, hbmOld);
::DeleteDC(hdcMem);
// Put the master image as a sub-image
RECT rcPart = { -nOffsetX, -nOffsetY, GetWidth() - nOffsetX, GetHeight() - nOffsetY };
HBITMAP hbmOld = imageModel.LockBitmap();
putSubImage(hbmNew, rcPart, hbmOld);
imageModel.UnlockBitmap(hbmOld);
// Push it
PushImageForUndo(hbmCropped);
PushImageForUndo(hbmNew);
NotifyImageChanged();
}
void ImageModel::SaveImage(LPCTSTR lpFileName)
void ImageModel::SaveImage(LPCWSTR lpFileName)
{
SaveDIBToFile(m_hBms[m_currInd], lpFileName, TRUE);
SaveDIBToFile(m_hbmMaster, lpFileName, TRUE);
}
BOOL ImageModel::IsImageSaved() const
@@ -175,17 +229,17 @@ void ImageModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSk
INT newHeight = oldHeight * nStretchPercentY / 100;
if (oldWidth != newWidth || oldHeight != newHeight)
{
HBITMAP hbm0 = CopyDIBImage(m_hBms[m_currInd], newWidth, newHeight);
HBITMAP hbm0 = CopyDIBImage(m_hbmMaster, newWidth, newHeight);
PushImageForUndo(hbm0);
}
if (nSkewDegX)
{
HBITMAP hbm1 = SkewDIB(m_hDrawingDC, m_hBms[m_currInd], nSkewDegX, FALSE);
HBITMAP hbm1 = SkewDIB(m_hDrawingDC, m_hbmMaster, nSkewDegX, FALSE);
PushImageForUndo(hbm1);
}
if (nSkewDegY)
{
HBITMAP hbm2 = SkewDIB(m_hDrawingDC, m_hBms[m_currInd], nSkewDegY, TRUE);
HBITMAP hbm2 = SkewDIB(m_hDrawingDC, m_hbmMaster, nSkewDegY, TRUE);
PushImageForUndo(hbm2);
}
NotifyImageChanged();
@@ -193,12 +247,12 @@ void ImageModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSk
int ImageModel::GetWidth() const
{
return GetDIBWidth(m_hBms[m_currInd]);
return GetDIBWidth(m_hbmMaster);
}
int ImageModel::GetHeight() const
{
return GetDIBHeight(m_hBms[m_currInd]);
return GetDIBHeight(m_hbmMaster);
}
void ImageModel::InvertColors()
@@ -238,15 +292,14 @@ void ImageModel::RotateNTimes90Degrees(int iN)
case 3:
{
HBITMAP hbm = Rotate90DegreeBlt(m_hDrawingDC, GetWidth(), GetHeight(), iN == 1, FALSE);
if (hbm)
PushImageForUndo(hbm);
PushImageForUndo(hbm);
break;
}
case 2:
{
PushImageForUndo();
StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(),
m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY);
::StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(),
m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY);
break;
}
}
@@ -261,27 +314,53 @@ void ImageModel::Clamp(POINT& pt) const
HBITMAP ImageModel::CopyBitmap()
{
// NOTE: An app cannot select a bitmap into more than one device context at a time.
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
HBITMAP ret = CopyDIBImage(m_hBms[m_currInd]);
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); // Re-select
HBITMAP hBitmap = LockBitmap();
HBITMAP ret = CopyDIBImage(hBitmap);
UnlockBitmap(hBitmap);
return ret;
}
BOOL ImageModel::IsBlackAndWhite()
{
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
BOOL bBlackAndWhite = IsBitmapBlackAndWhite(m_hBms[m_currInd]);
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); // Re-select
HBITMAP hBitmap = LockBitmap();
BOOL bBlackAndWhite = IsBitmapBlackAndWhite(hBitmap);
UnlockBitmap(hBitmap);
return bBlackAndWhite;
}
void ImageModel::PushBlackAndWhite()
{
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
HBITMAP hNewBitmap = ConvertToBlackAndWhite(m_hBms[m_currInd]);
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); // Re-select
HBITMAP hBitmap = LockBitmap();
HBITMAP hNewBitmap = ConvertToBlackAndWhite(hBitmap);
UnlockBitmap(hBitmap);
if (hNewBitmap)
PushImageForUndo(hNewBitmap);
PushImageForUndo(hNewBitmap);
}
HBITMAP ImageModel::LockBitmap()
{
// NOTE: An app cannot select a bitmap into more than one device context at a time.
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
HBITMAP hbmLocked = m_hbmMaster;
m_hbmMaster = NULL;
return hbmLocked;
}
void ImageModel::UnlockBitmap(HBITMAP hbmLocked)
{
m_hbmMaster = hbmLocked;
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
}
void ImageModel::SelectionClone(BOOL bUndoable)
{
if (!selectionModel.m_bShow || ::IsRectEmpty(&selectionModel.m_rc))
return;
if (bUndoable)
PushImageForUndo();
selectionModel.DrawSelection(m_hDrawingDC, paletteModel.GetBgColor(),
toolsModel.IsBackgroundTransparent());
NotifyImageChanged();
}

View File

@@ -10,6 +10,15 @@
/* HISTORYSIZE = number of possible undo-steps + 1 */
#define HISTORYSIZE 11
struct IMAGE_PART
{
CRect m_rcPart;
HBITMAP m_hbmImage;
BOOL m_bPartial;
void clear();
};
class ImageModel
{
public:
@@ -19,18 +28,21 @@ public:
HDC GetDC();
BOOL CanUndo() const { return m_undoSteps > 0; }
BOOL CanRedo() const { return m_redoSteps > 0; }
void PushImageForUndo(HBITMAP hbm = NULL);
void ResetToPrevious(void);
void PushImageForUndo();
void PushImageForUndo(HBITMAP hbm);
void PushImageForUndo(const RECT& rcPartial);
void Undo(BOOL bClearRedo = FALSE);
void Redo(void);
void ClearHistory(void);
void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0);
void SaveImage(LPCTSTR lpFileName);
void SaveImage(LPCWSTR lpFileName);
BOOL IsImageSaved() const;
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0);
int GetWidth() const;
int GetHeight() const;
HBITMAP CopyBitmap();
HBITMAP LockBitmap();
void UnlockBitmap(HBITMAP hbmLocked);
void InvertColors();
void FlipHorizontally();
void FlipVertically();
@@ -39,12 +51,17 @@ public:
void NotifyImageChanged();
BOOL IsBlackAndWhite();
void PushBlackAndWhite();
void SelectionClone(BOOL bUndoable = TRUE);
protected:
HDC m_hDrawingDC; // The device context for this class
HBITMAP m_hbmMaster; // The master bitmap
int m_currInd; // The current index in m_hBms
int m_undoSteps; // The undo-able count
int m_redoSteps; // The redo-able count
HBITMAP m_hBms[HISTORYSIZE]; // A rotation buffer of HBITMAPs
IMAGE_PART m_historyItems[HISTORYSIZE]; // A ring buffer of IMAGE_PARTs
HGDIOBJ m_hbmOld;
void SwapPart();
void PushDone();
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-bg-BG.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-bg-BG.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-cs-CZ.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-cs-CZ.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-de-DE.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-de-DE.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^U", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-en-GB.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-en-GB.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar.bmp"
IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -10,7 +10,7 @@
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-es-ES.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-es-ES.bmp"
ID_MENU MENU
BEGIN
@@ -142,6 +142,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_ESTONIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-et-EE.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-et-EE.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_BASQUE, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-eu-ES.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-eu-ES.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-fr-FR.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-fr-FR.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-he-IL.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-he-IL.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-hu-HU.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-hu-HU.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-id-ID.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-id-ID.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-it-IT.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-it-IT.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -9,7 +9,7 @@
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ja-JP.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ja-JP.bmp"
ID_MENU MENU
BEGIN
@@ -141,6 +141,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-nl-NL.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-nl-NL.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-no-NO.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-no-NO.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -10,7 +10,7 @@
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pl-PL.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pl-PL.bmp"
ID_MENU MENU
BEGIN
@@ -142,6 +142,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-BR.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-BR.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-PT.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-PT.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -9,7 +9,7 @@
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ro-RO.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ro-RO.bmp"
ID_MENU MENU
BEGIN
@@ -17,8 +17,8 @@ BEGIN
BEGIN
MENUITEM "&Nou\tCtrl+N", IDM_FILENEW
MENUITEM "&Deschidere...\tCtrl+O", IDM_FILEOPEN
MENUITEM "&Păstrează\tCtrl+S", IDM_FILESAVE
MENUITEM "Păst&rare în...", IDM_FILESAVEAS
MENUITEM "&Salvează\tCtrl+S", IDM_FILESAVE
MENUITEM "Salvea&ză ca...", IDM_FILESAVEAS
MENUITEM SEPARATOR
MENUITEM "Din aparat media...", IDM_FILEFROMSCANNERORCAMERA
MENUITEM SEPARATOR
@@ -141,6 +141,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100
@@ -230,7 +234,7 @@ BEGIN
IDS_WINDOWTITLE "%s - Pictare"
IDS_INFOTITLE "Pictare pentru ReactOS"
IDS_INFOTEXT "Disponibilă sub licența GNU Lesser General Public (vedeți www.gnu.org)"
IDS_SAVEPROMPTTEXT "Doriți păstrarea modificărilor din %s?"
IDS_SAVEPROMPTTEXT "Doriți salvarea modificărilor din %s?"
IDS_DEFAULTFILENAME "Fără nume"
IDS_MINIATURETITLE "Miniatură"
IDS_TOOLTIP1 "Golire selecție"
@@ -263,7 +267,7 @@ BEGIN
IDS_VERTICAL "Vertical"
IDS_PRINTRES "%d x %d pixeli/cm"
IDS_CANTPASTE "Nu a putut fi lipit din clipboard. Formatul de date este fie incorect, fie nesuportat."
IDS_SAVEERROR "Eșec în păstrarea imaginii bitmap („hartă de biți”) în fișierul:\n\n%s"
IDS_SAVEERROR "Eșec în salvarea imaginii bitmap („hartă de biți”) în fișierul:\n\n%s"
IDS_CANTSENDMAIL "Eșec în trimiterea unei scrisori."
IDS_LOSECOLOR "În această operațiune informațiile legate de culoare vor fi pierdute. Sigur veți continua?"
END

View File

@@ -11,7 +11,7 @@
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ru-RU.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ru-RU.bmp"
ID_MENU MENU
BEGIN
@@ -143,6 +143,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sk-SK.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sk-SK.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sq-AL.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sq-AL.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sv-SE.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sv-SE.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-tr-TR.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-tr-TR.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -9,7 +9,7 @@
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-uk-UA.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-uk-UA.bmp"
ID_MENU MENU
BEGIN
@@ -141,6 +141,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_VIETNAMESE, SUBLANG_VIETNAMESE_VIETNAM
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-vi-VN.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-vi-VN.bmp"
ID_MENU MENU
BEGIN
@@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -10,7 +10,7 @@
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-CN.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-CN.bmp"
ID_MENU MENU
BEGIN
@@ -142,6 +142,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_HONGKONG
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-HK.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-HK.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-TW.bmp"
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-TW.bmp"
ID_MENU MENU
BEGIN
@@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,13 +7,12 @@
#include "precomp.h"
#include <dlgs.h>
#include <mapi.h>
#include <mapicode.h>
POINT g_ptStart, g_ptEnd;
BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry
HINSTANCE g_hinstExe = NULL;
TCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
WCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
WCHAR g_szMailTempFile[MAX_LONG_PATH] = { 0 };
BOOL g_isAFile = FALSE;
BOOL g_imageSaved = FALSE;
@@ -23,20 +22,32 @@ CMainWindow mainWindow;
/* FUNCTIONS ********************************************************/
void ShowOutOfMemory(void)
{
WCHAR szText[256];
::FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
ERROR_OUTOFMEMORY,
0,
szText, _countof(szText),
NULL);
mainWindow.MessageBox(szText, NULL, MB_ICONERROR);
}
// get file name extension from filter string
static BOOL
FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN)
FileExtFromFilter(LPWSTR pExt, OPENFILENAME *pOFN)
{
LPTSTR pchExt = pExt;
LPWSTR pchExt = pExt;
*pchExt = 0;
DWORD nIndex = 1;
for (LPCTSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
for (LPCWSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
{
pch += lstrlen(pch) + 1;
if (pOFN->nFilterIndex == nIndex)
{
for (++pch; *pch && *pch != _T(';'); ++pch)
for (++pch; *pch && *pch != L';'; ++pch)
{
*pchExt++ = *pch;
}
@@ -44,7 +55,7 @@ FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN)
CharLower(pExt);
return TRUE;
}
pch += lstrlen(pch) + 1;
pch += wcslen(pch) + 1;
}
return FALSE;
}
@@ -54,19 +65,19 @@ static UINT_PTR APIENTRY
OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hParent;
OFNOTIFY *pon;
OFNOTIFYW *pon;
WCHAR Path[MAX_PATH];
switch (uMsg)
{
case WM_NOTIFY:
pon = (OFNOTIFY *)lParam;
pon = (OFNOTIFYW *)lParam;
if (pon->hdr.code == CDN_TYPECHANGE)
{
hParent = GetParent(hwnd);
TCHAR Path[MAX_PATH];
SendMessage(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path);
FileExtFromFilter(PathFindExtension(Path), pon->lpOFN);
SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)PathFindFileName(Path));
lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile);
SendMessageW(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path);
FileExtFromFilter(PathFindExtensionW(Path), pon->lpOFN);
SendMessageW(hParent, CDM_SETCONTROLTEXT, cmb13, (LPARAM)PathFindFileNameW(Path));
StringCchCopyW(pon->lpOFN->lpstrFile, pon->lpOFN->nMaxFile, Path);
}
break;
}
@@ -117,9 +128,9 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
strFileTitle += L".png";
// Save it to the temporary file
HBITMAP hbm = imageModel.CopyBitmap();
BOOL ret = SaveDIBToFile(hbm, g_szMailTempFile, FALSE, Gdiplus::ImageFormatPNG);
::DeleteObject(hbm);
HBITMAP hbmLocked = imageModel.LockBitmap();
BOOL ret = SaveDIBToFile(hbmLocked, g_szMailTempFile, FALSE, Gdiplus::ImageFormatPNG);
imageModel.UnlockBitmap(hbmLocked);
if (!ret)
{
g_szMailTempFile[0] = UNICODE_NULL;
@@ -183,21 +194,22 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
return FALSE; // Failure
}
BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
BOOL CMainWindow::GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
{
static OPENFILENAME ofn = { 0 };
static CString strFilter;
static OPENFILENAMEW ofn = { 0 };
static CStringW strFilter;
if (ofn.lStructSize == 0)
{
// The "All Files" item text
CString strAllPictureFiles;
CStringW strAllPictureFiles;
strAllPictureFiles.LoadString(g_hinstExe, IDS_ALLPICTUREFILES);
// Get the import filter
CSimpleArray<GUID> aguidFileTypesI;
CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles,
CImage::excludeDefaultLoad, _T('\0'));
CImage::excludeDefaultLoad, L'|');
strFilter.Replace(L'|', UNICODE_NULL);
// Initializing the OPENFILENAME structure for GetOpenFileName
ZeroMemory(&ofn, sizeof(ofn));
@@ -211,20 +223,21 @@ BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
ofn.lpstrFile = pszFile;
ofn.nMaxFile = cchMaxFile;
return ::GetOpenFileName(&ofn);
return ::GetOpenFileNameW(&ofn);
}
BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
{
static OPENFILENAME sfn = { 0 };
static CString strFilter;
static OPENFILENAMEW sfn = { 0 };
static CStringW strFilter;
if (sfn.lStructSize == 0)
{
// Get the export filter
CSimpleArray<GUID> aguidFileTypesE;
CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL,
CImage::excludeDefaultSave, _T('\0'));
CImage::excludeDefaultSave, L'|');
strFilter.Replace(L'|', UNICODE_NULL);
// Initializing the OPENFILENAME structure for GetSaveFileName
ZeroMemory(&sfn, sizeof(sfn));
@@ -240,7 +253,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
if (*pchDotExt == UNICODE_NULL)
{
// Choose PNG
wcscat(pszFile, L".png");
StringCchCatW(pszFile, cchMaxFile, L".png");
for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
{
if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
@@ -254,7 +267,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
sfn.lpstrFile = pszFile;
sfn.nMaxFile = cchMaxFile;
return ::GetSaveFileName(&sfn);
return ::GetSaveFileNameW(&sfn);
}
BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor)
@@ -286,9 +299,9 @@ BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor)
HWND CMainWindow::DoCreate()
{
::LoadString(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName));
::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName));
CString strTitle;
CStringW strTitle;
strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName));
RECT& rc = registrySettings.WindowPlacement.rcNormalPosition;
@@ -297,13 +310,8 @@ HWND CMainWindow::DoCreate()
// entry point
INT WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow)
wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
{
#ifdef _DEBUG
// Report any memory leaks on exit
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
g_hinstExe = hInstance;
// Initialize common controls library
@@ -318,7 +326,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
// Create the main window
if (!mainWindow.DoCreate())
{
MessageBox(NULL, TEXT("Failed to create main window."), NULL, MB_ICONERROR);
MessageBox(NULL, L"Failed to create main window.", NULL, MB_ICONERROR);
return 1;
}
@@ -330,7 +338,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
mainWindow.ShowWindow(registrySettings.WindowPlacement.showCmd);
// Load the access keys
HACCEL hAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(800));
HACCEL hAccel = ::LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(800));
// The message loop
MSG msg;
@@ -339,7 +347,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
if (fontsDialog.IsWindow() && fontsDialog.IsDialogMessage(&msg))
continue;
if (::TranslateAccelerator(mainWindow, hAccel, &msg))
if (::TranslateAcceleratorW(mainWindow, hAccel, &msg))
continue;
::TranslateMessage(&msg);

View File

@@ -36,8 +36,8 @@ HWND CMiniatureWindow::DoCreate(HWND hwndParent)
(LONG)(registrySettings.ThumbYPos + registrySettings.ThumbHeight)
};
TCHAR strTitle[100];
::LoadString(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
WCHAR strTitle[100];
::LoadStringW(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME;
return Create(hwndParent, rc, strTitle, style, WS_EX_PALETTEWINDOW);

Some files were not shown because too many files have changed in this diff Show More