7zip/CPP/7zip/UI/GUI/CompressDialog.rc
Fernando Nillsson Cidade 1eca44e7a7 v2026.3.22.0
English

This patch addresses the review feedback around Windows installer metadata and update-path handling, and removes a partially implemented UI surface that duplicated the existing multi-output path controls.

Installer / ARP metadata
- The installer previously wrote fork-specific hardcoded values into the Windows Uninstall registry entry (`DisplayName`, `DisplayVersion`, `Publisher`).
- That created drift between the installed product metadata and the actual upstream 7-Zip version/author macros used elsewhere in the tree.
- The patch removes the hardcoded fork values and derives the registry values from the existing 7-Zip definitions:
  - `DisplayName` now uses the existing versioned product string (`7-Zip 26.00 (x64)` on 64-bit builds).
  - `DisplayVersion` now comes from `MY_VERSION`.
  - `Publisher` now comes from `MY_AUTHOR_NAME`.
- This makes the Add/Remove Programs entry consistent with the rest of the build metadata and removes the need for manual source edits on each branch-specific release.

Compression dialog cleanup
- The `Paths...` button and its dedicated dialog were not part of the stable workflow.
- At this point the main compression dialog already exposes the supported multi-output behavior through the output-count selector plus the existing archive path rows and browse buttons.
- Keeping a second path-editing dialog in parallel would add maintenance overhead and duplicate UI/state management without providing new functionality.
- For that reason, this patch removes the incomplete/duplicate surface entirely:
  - the `Paths...` button was removed from the dialog resource,
  - the handler declaration/definition was removed,
  - the auxiliary `COutputArcPathsDialog` class was removed,
  - the associated resource IDs and helper parsing/serialization code were removed.
- Functional capability is unchanged: users still configure multiple output targets through the existing archive path controls already present in the compression dialog.

Update path deduplication
- In `UpdateGUI.cpp`, `AddUniquePath()` previously compared paths with a case-sensitive equality check.
- On Windows, this could fail to deduplicate logically identical paths that differ only by casing.
- The comparison is now case-insensitive (`IsEqualTo_NoCase()`), which matches expected Windows path behavior more closely and prevents duplicate item entries in the update/compression path collection stage.
- This is intentionally a minimal fix: it addresses case-only duplication without changing the broader path normalization rules.

Working directory safety
- `PrepareWorkingDirForArchivePath()` previously ignored the return value of `MyGetFullPathName()`.
- If full-path resolution failed, the code could continue with an invalid or empty path and derive an incorrect working directory.
- The function now exits early when `MyGetFullPathName()` fails, leaving `options.WorkingDir` empty.
- This is a conservative change: the downstream update flow already has fallback behavior for an empty working directory, so the patch avoids propagating bad path state without altering the existing fallback model.

Header consistency / non-functional cleanup
- `LangUtils.h` now provides a non-`Z7_LANG` fallback declaration for `LangString_OnlyFromLangFile()`.
- This is not a functional runtime change for normal localized builds, but it keeps the header interface consistent across configurations and avoids IDE/static-analysis mismatches where `Z7_LANG` is not visible to the parser.

Behavioral impact
- No archive format logic was changed.
- No codec behavior was changed.
- No new persistence format was introduced.
- The only runtime behavior changes are:
  - correct Windows ARP metadata,
  - removal of dead/duplicate UI,
  - case-insensitive deduplication of update input paths,
  - safer handling of full-path resolution failure before working directory derivation.

Validation
- The change set was validated with targeted code search and diff review to ensure the removed dialog/button plumbing no longer has remaining references.
- `git diff --check` was also run on the touched files.
- A full build/test pass has not yet been run in this environment.

Portuguese

Este patch responde ao feedback de revisão relacionado aos metadados do instalador no Windows e ao tratamento de caminhos no fluxo de atualização, além de remover uma superfície de UI parcialmente implementada que duplicava os controles já existentes para múltiplos caminhos de saída.

Instalador / metadados do item no Windows
- O instalador estava gravando valores hardcoded e específicos do fork na chave de desinstalação do Windows (`DisplayName`, `DisplayVersion`, `Publisher`).
- Isso criava divergência entre os metadados exibidos em “Aplicativos instalados / Programas e Recursos” e as macros oficiais de versão/autoria já utilizadas no restante do código-fonte.
- O patch remove esses valores fixos do fork e passa a derivar os valores diretamente das definições já existentes do 7-Zip:
  - `DisplayName` agora usa a string versionada já existente do produto (`7-Zip 26.00 (x64)` em builds 64-bit).
  - `DisplayVersion` agora vem de `MY_VERSION`.
  - `Publisher` agora vem de `MY_AUTHOR_NAME`.
- Com isso, a entrada instalada no Windows fica consistente com os demais metadados do build e deixa de exigir edição manual do código a cada release da branch.

Limpeza do diálogo de compressão
- O botão `Paths...` e a dialog auxiliar associada não faziam parte de um fluxo estável/finalizado.
- Neste momento, a janela principal de compressão já expõe o comportamento suportado de múltiplas saídas por meio do seletor de quantidade de saídas, dos campos de caminho de arquivo e dos botões de browse já existentes.
- Manter uma segunda dialog para edição textual desses caminhos aumentaria o custo de manutenção e duplicaria a lógica de estado/UI sem adicionar capacidade funcional nova.
- Por esse motivo, este patch remove completamente essa superfície incompleta/duplicada:
  - o botão `Paths...` foi removido do recurso da dialog,
  - a declaração e a implementação do handler foram removidas,
  - a classe auxiliar `COutputArcPathsDialog` foi removida,
  - os IDs de recurso associados e os helpers internos de parsing/serialização dessa dialog também foram removidos.
- A capacidade funcional permanece a mesma: o usuário continua podendo configurar múltiplos destinos pelos controles de caminhos de saída já existentes na própria janela de compressão.

Deduplicação de caminhos no fluxo de atualização
- Em `UpdateGUI.cpp`, a função `AddUniquePath()` comparava caminhos usando igualdade case-sensitive.
- Em Windows, isso podia falhar em deduplicar caminhos logicamente idênticos que diferiam apenas por maiúsculas/minúsculas.
- A comparação agora é case-insensitive (`IsEqualTo_NoCase()`), o que se alinha melhor ao comportamento esperado para caminhos no Windows e evita entradas duplicadas durante a coleta dos caminhos de itens no fluxo de atualização/compressão.
- A alteração foi mantida propositalmente mínima: ela corrige a duplicação por diferença de casing sem alterar as regras mais amplas de normalização de caminhos.

Segurança na preparação do diretório de trabalho
- `PrepareWorkingDirForArchivePath()` ignorava o valor de retorno de `MyGetFullPathName()`.
- Se a resolução para caminho absoluto falhasse, o código poderia continuar com um caminho inválido ou vazio e, a partir disso, derivar um diretório de trabalho incorreto.
- Agora a função retorna imediatamente quando `MyGetFullPathName()` falha, deixando `options.WorkingDir` vazio.
- Essa mudança é conservadora: o fluxo subsequente de atualização já possui fallback quando o diretório de trabalho está vazio, então o patch evita propagar um estado inconsistente sem alterar o modelo de fallback já existente.

Consistência de headers / limpeza não funcional
- `LangUtils.h` agora fornece um fallback para `LangString_OnlyFromLangFile()` também quando `Z7_LANG` não está definido.
- Isso não altera o comportamento funcional em builds localizados normais, mas mantém a interface do header consistente entre configurações e evita divergências em IDEs/analisadores estáticos quando `Z7_LANG` não está visível para o parser.

Impacto comportamental
- Nenhuma lógica de formato de arquivo foi alterada.
- Nenhum comportamento de codec foi alterado.
- Nenhum novo formato de persistência foi introduzido.
- As únicas mudanças observáveis em runtime são:
  - correção dos metadados exibidos pelo Windows para a instalação,
  - remoção de uma UI morta/duplicada,
  - deduplicação case-insensitive de caminhos no fluxo de atualização,
  - tratamento mais seguro de falha ao resolver caminho absoluto antes de derivar o diretório de trabalho.

Validação
- O conjunto de alterações foi validado com buscas direcionadas no código e revisão de diff para garantir que a plumbing removida da dialog/botão não deixou referências residuais.
- Também foi executado `git diff --check` nos arquivos alterados.
- Ainda não foi executado um ciclo completo de build/testes neste ambiente.
2026-03-22 01:36:40 -03:00

251 lines
9.7 KiB
Text

#include "CompressDialogRes.h"
#include "../../GuiCommon.rc"
#define xc 400
#define yc 430
#undef gSize
#undef gSpace
#undef g0xs
#undef g1x
#undef g1xs
#undef g2xs
#undef g3x
#undef g3xs
#undef g4x
#undef g4x2
#undef g4xs
#undef g4xs2
#define gSize 192
#define gSpace 24
#define g1xs 88
#define g0xs (gSize - g1xs)
#define g1x (m + g0xs)
#define g3xs 52
#define g2xs (gSize - g3xs)
#define g3x (m + g2xs)
#define g4x (m + gSize + gSpace)
#define g4x2 (g4x + m)
#define g4xs (xc - gSize - gSpace)
#define g4xs2 (g4xs - m - m)
#define yTopShift 105
#define yOpt (80 + yTopShift)
#define xArcFolderOffs 40
#undef GROUP_Y_SIZE
#undef GROUP_Y_SIZE_ENCRYPT
#ifdef UNDER_CE
#define GROUP_Y_SIZE 8
#define GROUP_Y_SIZE_ENCRYPT 8
#else
#define GROUP_Y_SIZE 64
#define GROUP_Y_SIZE_ENCRYPT 128
#endif
// #define DICT_SIZE_SPACE 8
// #define DICT_SIZE 54
// #define DICT_x (g1x + g1xs - DICT_SIZE)
// #define DICT2_x (DICT_x - DICT_SIZE_SPACE - DICT_SIZE)
#define yPsw (yOpt + GROUP_Y_SIZE + 8)
IDD_COMPRESS DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Add to Archive"
BEGIN
LTEXT "", IDT_COMPRESS_ARCHIVE_FOLDER, m + xArcFolderOffs, m, xc - xArcFolderOffs, 8
LTEXT "&Count:", IDT_COMPRESS_OUTPUT_PATHS_NUM, m, 20, xArcFolderOffs, 8
COMBOBOX IDC_COMPRESS_OUTPUT_PATHS_NUM, m + xArcFolderOffs, 18, 56, 80, MY_COMBO
CONTROL "Map selected items to output archives", IDX_COMPRESS_SEPARATE_ITEMS, MY_CHECKBOX,
m + xArcFolderOffs + 122, 20, xc - xArcFolderOffs - 122, 10
LTEXT "&Archive:", IDT_COMPRESS_ARCHIVE, m, 41, xArcFolderOffs, 8
COMBOBOX IDC_COMPRESS_ARCHIVE, m + xArcFolderOffs, 39, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE, xs - m - bxsDots, 37, bxsDots, bys, WS_GROUP
COMBOBOX IDC_COMPRESS_ARCHIVE2, m + xArcFolderOffs, 60, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE2, xs - m - bxsDots, 58, bxsDots, bys
COMBOBOX IDC_COMPRESS_ARCHIVE3, m + xArcFolderOffs, 81, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE3, xs - m - bxsDots, 79, bxsDots, bys
COMBOBOX IDC_COMPRESS_ARCHIVE4, m + xArcFolderOffs, 102, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE4, xs - m - bxsDots, 100, bxsDots, bys
COMBOBOX IDC_COMPRESS_ARCHIVE5, m + xArcFolderOffs, 123, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE5, xs - m - bxsDots, 121, bxsDots, bys
LTEXT "Archive &format:", IDT_COMPRESS_FORMAT, m, 41 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_FORMAT, g1x, 39 + yTopShift, g1xs, 80, MY_COMBO | CBS_SORT
LTEXT "Compression &level:", IDT_COMPRESS_LEVEL, m, 62 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_LEVEL, g1x, 60 + yTopShift, g1xs, 80, MY_COMBO
LTEXT "Compression &method:", IDT_COMPRESS_METHOD, m, 83 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_METHOD, g1x, 81 + yTopShift, g1xs, 80, MY_COMBO
LTEXT "&Dictionary size:", IDT_COMPRESS_DICTIONARY, m, 104 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_DICTIONARY, g1x, 102 + yTopShift, g1xs, 167, MY_COMBO
// LTEXT "&Dictionary size:", IDT_COMPRESS_DICTIONARY, m, 104, DICT_x - m, 16 // 8, SS_LEFTNOWORDWRAP
// LTEXT "", IDT_COMPRESS_PARAMS_INFO, m, 283, xs, MY_TEXT_NOPREFIX
// CTEXT "-", 0, DICT_x - DICT_SIZE_SPACE, 104, DICT_SIZE_SPACE, 8
// COMBOBOX IDC_COMPRESS_DICTIONARY2, DICT2_x, 102, DICT_SIZE, 140, MY_COMBO
// COMBOBOX IDC_COMPRESS_DICTIONARY, DICT_x, 102, DICT_SIZE, 140, MY_COMBO
LTEXT "&Word size:", IDT_COMPRESS_ORDER, m, 125 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_ORDER, g1x, 123 + yTopShift, g1xs, 140, MY_COMBO
LTEXT "&Solid Block size:", IDT_COMPRESS_SOLID, m, 146 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_SOLID, g1x, 144 + yTopShift, g1xs, 140, MY_COMBO
LTEXT "Number of CPU &threads:", IDT_COMPRESS_THREADS, m, 167 + yTopShift, g0xs, 8
COMBOBOX IDC_COMPRESS_THREADS, g1x, 165 + yTopShift, g1xs - 40, 140, MY_COMBO
RTEXT "", IDT_COMPRESS_HARDWARE_THREADS, g1x + g1xs - 40, 167 + yTopShift, 40, 16, SS_NOPREFIX
LTEXT "Memory usage for Compressing:", IDT_COMPRESS_MEMORY, m, 184 + yTopShift, g2xs, 8
COMBOBOX IDC_COMPRESS_MEM_USE, g3x, 188 + yTopShift, g3xs, 140, MY_COMBO
LTEXT "", IDT_COMPRESS_MEMORY_VALUE, m, 194 + yTopShift, g2xs, MY_TEXT_NOPREFIX
LTEXT "Memory usage for Decompressing:", IDT_COMPRESS_MEMORY_DE, m, 208 + yTopShift, g2xs, 8
RTEXT "", IDT_COMPRESS_MEMORY_DE_VALUE, g3x, 208 + yTopShift, g3xs, MY_TEXT_NOPREFIX
LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 225 + yTopShift, gSize, 8
COMBOBOX IDC_COMPRESS_VOLUME, m, 237 + yTopShift, gSize, 73, MY_COMBO_WITH_EDIT
LTEXT "Parameters:", IDT_COMPRESS_PARAMETERS, m, 256 + yTopShift, gSize, 8
EDITTEXT IDE_COMPRESS_PARAMETERS, m, 268 + yTopShift, gSize, 14, ES_AUTOHSCROLL
PUSHBUTTON "Options", IDB_COMPRESS_OPTIONS, m, 292 + yTopShift, bxs, bys
LTEXT "", IDT_COMPRESS_OPTIONS, m + bxs + m, 294 + yTopShift, gSize - bxs - m, 16, SS_NOPREFIX
LTEXT "&Update mode:", IDT_COMPRESS_UPDATE_MODE, g4x, 41 + yTopShift, 80, 8
COMBOBOX IDC_COMPRESS_UPDATE_MODE, g4x + 84, 39 + yTopShift, g4xs - 84, 80, MY_COMBO
LTEXT "Path mode:", IDT_COMPRESS_PATH_MODE, g4x, 61 + yTopShift, 80, 8
COMBOBOX IDC_COMPRESS_PATH_MODE, g4x + 84, 59 + yTopShift, g4xs - 84, 80, MY_COMBO
GROUPBOX "Options", IDG_COMPRESS_OPTIONS, g4x, yOpt, g4xs, GROUP_Y_SIZE
CONTROL "Create SF&X archive", IDX_COMPRESS_SFX, MY_CHECKBOX,
g4x2, yOpt + 14, g4xs2, 10
CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX,
g4x2, yOpt + 30, g4xs2, 10
CONTROL "Delete files after compression", IDX_COMPRESS_DEL, MY_CHECKBOX,
g4x2, yOpt + 46, g4xs2, 10
GROUPBOX "Encryption", IDG_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, GROUP_Y_SIZE_ENCRYPT
LTEXT "Enter &password:", IDT_PASSWORD_ENTER, g4x2, yPsw + 14, g4xs2, 8
EDITTEXT IDE_COMPRESS_PASSWORD1, g4x2, yPsw + 26, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
LTEXT "Reenter password:", IDT_PASSWORD_REENTER, g4x2, yPsw + 46, g4xs2, 8
EDITTEXT IDE_COMPRESS_PASSWORD2, g4x2, yPsw + 58, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX,
g4x2, yPsw + 79, g4xs2, 10
LTEXT "&Encryption method:", IDT_COMPRESS_ENCRYPTION_METHOD, g4x2, yPsw + 95, 100, 8
COMBOBOX IDC_COMPRESS_ENCRYPTION_METHOD, g4x2 + 100, yPsw + 93, g4xs2 - 100, 198, MY_COMBO
CONTROL "Encrypt file &names", IDX_COMPRESS_ENCRYPT_FILE_NAMES, MY_CHECKBOX,
g4x2, yPsw + 111, g4xs2, 10
DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bx2, by, bxs, bys
PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
END
#ifdef UNDER_CE
#undef m
#undef xc
#undef yc
#define m 4
#define xc 152
#define yc 160
IDD_COMPRESS_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Add to Archive"
MY_FONT
BEGIN
COMBOBOX IDC_COMPRESS_ARCHIVE, m, m, xc - bxsDots - m, 126, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE, xs - m - bxsDots, m, bxsDots, 12, WS_GROUP
COMBOBOX IDC_COMPRESS_FORMAT, m , 22, 32, 80, MY_COMBO | CBS_SORT
COMBOBOX IDC_COMPRESS_LEVEL, m + 36, 22, 68, 80, MY_COMBO
COMBOBOX IDC_COMPRESS_METHOD, m + 108, 22, 44, 80, MY_COMBO
COMBOBOX IDC_COMPRESS_DICTIONARY, m, 40, 40, 80, MY_COMBO
COMBOBOX IDC_COMPRESS_ORDER, m + 44, 40, 32, 80, MY_COMBO
COMBOBOX IDC_COMPRESS_SOLID, m + 80, 40, 40, 80, MY_COMBO
COMBOBOX IDC_COMPRESS_THREADS, m + 124, 40, 28, 80, MY_COMBO
LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 60, 32, 8
COMBOBOX IDC_COMPRESS_VOLUME, m + 32, 58, 44, 73, MY_COMBO_WITH_EDIT
LTEXT "Parameters:", IDT_COMPRESS_PARAMETERS, m + 80, 60, 48, 8
EDITTEXT IDE_COMPRESS_PARAMETERS, m + 128, 58, 24, 13, ES_AUTOHSCROLL
COMBOBOX IDC_COMPRESS_UPDATE_MODE, m, 76, 88, 80, MY_COMBO
CONTROL "SF&X", IDX_COMPRESS_SFX, MY_CHECKBOX, m + 92, 77, 60, 10
CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX, m, 94, xc, 10
LTEXT "Enter &password:", IDT_PASSWORD_ENTER, m, 112, 60, 8
EDITTEXT IDE_COMPRESS_PASSWORD1, m + 60, 110, 44, 13, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m + 108, 112, 44, 10
COMBOBOX IDC_COMPRESS_ENCRYPTION_METHOD, m, 128, 48, 198, MY_COMBO
CONTROL "Encrypt file &names", IDX_COMPRESS_ENCRYPT_FILE_NAMES, MY_CHECKBOX, m + 52, 130, 100, 10
OK_CANCEL
END
#endif
STRINGTABLE
BEGIN
IDS_PASSWORD_NOT_MATCH "Passwords do not match"
IDS_PASSWORD_USE_ASCII "Use only English letters, numbers and special characters (!, #, $, ...) for password."
IDS_PASSWORD_TOO_LONG "Password is too long"
IDS_METHOD_STORE "Store"
IDS_METHOD_FASTEST "Fastest"
IDS_METHOD_FAST "Fast"
IDS_METHOD_NORMAL "Normal"
IDS_METHOD_MAXIMUM "Maximum"
IDS_METHOD_ULTRA "Ultra"
IDS_COMPRESS_UPDATE_MODE_ADD "Add and replace files"
IDS_COMPRESS_UPDATE_MODE_UPDATE "Update and add files"
IDS_COMPRESS_UPDATE_MODE_FRESH "Freshen existing files"
IDS_COMPRESS_UPDATE_MODE_SYNC "Synchronize files"
IDS_OPEN_TYPE_ALL_FILES "All Files"
IDS_COMPRESS_SET_ARCHIVE_BROWSE "Browse"
IDS_COMPRESS_NON_SOLID "Non-solid"
IDS_COMPRESS_SOLID "Solid"
IDS_SPLIT_CONFIRM "Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?"
IDS_COMPRESS_SEC "sec"
IDS_COMPRESS_NS "ns"
IDS_MEM_OPERATION_BLOCKED "The operation was blocked by 7-Zip."
END
#include "CompressOptionsDialog.rc"