Opção 0xff Value In Bininary


Java leitura 2 byte inteiro em 239s complemento de arquivo binário em inteiro Eu estou tentando analisar um arquivo binário contendo valores. Nas especificações, ele diz que cada valor é representado como um inteiro de 2 bytes no formato de complemento 2s. Eu estou lendo o arquivo em uma matriz de bytes chamada de dados: Os valores parecem bem, no entanto, quando eu tento gravá-los de volta para o arquivo: tempInt sendo o valor em int. Quando eu li no arquivo que eu escrevi, nem todos os valores são os mesmos. Alguns deles, mas não todos. Estou faltando algo aqui UPDATE: Eu plottet os valores de comparação. A metade superior são os valores que eu li a partir do arquivo. A metade inferior são os valores que leio a partir do arquivo, em seguida, escreveu para um novo arquivo e, em seguida, ler novamente. Eu acho que os gráficos parecem muito semelhantes para que ele seja completamente errado. UPDATE 2: os bytes que li do arquivo de entrada: os bytes que li do arquivo que escrevi dos valores acima: UPDATE 3: vou postar o código agora. Para fazer isso, será necessário explicar como os dados são armazenados no arquivo (entretanto, é o formato EDF). Existem 3 componentes importantes: Registros. Sinais e Amostras. Uma amostra é representada como um inteiro de 2 bytes no formato de complemento 2s e é armazenado como um número inteiro. Um sinal é uma matriz de amostras. No entanto, os sinais não são armazenados consecutivamente no arquivo. Isto é onde os registros entram. Um registro contém uma quantidade predefinida de amostras de cada sinal. Os registros são armazenados consecutivamente no arquivo. Portanto, cada registro contém uma parte de cada sinal. A quantidade de amostras é definida nos arquivos meta, a variável que contém esse valor é chamada nrOfSamplesPerSignalInEachRecordGlobal no meu código. Então, você deve fazer um loop sobre todos os registros para se agarra cada sinal. Esta é a função que armazena os bytes do arquivo na estrutura de dados dos sinais: esta é a função que grava as amostras de volta aos bytes: Sim - você está lendo-os em formato pouco específico (o primeiro valor é o menos importante), mas você está Escrevendo-os em formato grande-endian (o primeiro valor é o mais importante), assumindo que você está escrevendo um então b. Basta inverter a ordem quando você os escreve, assumindo que o arquivo deve ser pequeno-endiante: veja mais sobre esta questão em StackoverflowDescription Imprime os dados na porta serial como texto ASCII legível por humanos. Este comando pode assumir várias formas. Os números são impressos usando um caractere ASCII para cada dígito. Flutuadores são impressos de forma semelhante como dígitos ASCII, padrão com duas casas decimais. Bytes são enviados como um único caractere. Caracteres e strings são enviados como estão. Por exemplo: Serial. print (78) dá 78 Serial. print (1.23456) dá 1.23 Serial. print (N) dá N Serial. print (Hello world.) Dá Hello world. Um segundo parâmetro opcional especifica a base (formato) para usar os valores permitidos são BIN (binário ou base 2), OCT (octal ou base 8), DEC (decimal ou base 10), HEX (hexadecimal ou base 16) . Para números de ponto flutuante, este parâmetro especifica o número de casas decimais a serem usadas. Por exemplo: Serial. print (78, BIN) dá 1001110 Serial. print (78, OCT) dá 116 Serial. print (78, DEC) dá 78 Serial. print (78, HEX) dá 4E Serial. println (1.23456, 0 ) Dá 1 Serial. println (1.23456, 2) dá 1.23 Serial. println (1.23456, 4) dá 1.2346 Você pode passar cadeias de memória flash-based para Serial. print (), envolvendo-os com F (). Por exemplo. Serial. print (val) Serial. print (val, format) Parâmetros val: o valor a imprimir - qualquer formato de tipo de dados: especifica os tipos de número (para tipos de dados integrados) ou número de casas decimais (para tipos de ponto flutuante) sizet ( Long): print () retorna o número de bytes escritos, embora a leitura desse número seja opcional Usa um loop FOR para dados e imprime um número em vários formatos. Int x 0 variável void setup 40 41 123 Serial. Inicie 40 9600 41 abra a porta serial a 9600 bps: 125 loop vazio 40 41 123 imprimir etiquetas Serial. Imprimir 40 quotNO FORMATquot 41 imprime um rótulo Serial. Impressão 40 quot t quot 41 imprime um separador Serial. Imprimir 40 quotDECquot 41 Serial. Imprimir 40 quot t quot 41 Serial. Imprimir 40 quotHEXquot 41 Serial. Imprimir 40 quot t quot 41 Serial. Imprimir 40 quotOCTquot 41 Serial. Imprimir 40 quot t quot 41 Serial. Imprimir 40 quotBINquot 41 Serial. Impressão 40 quot t quot 41 para 40 x 0 x lt 64 x 41 123 apenas parte do gráfico ASCII, mude para se adequar imprimi-lo em muitos formatos: Serial. Imprima impressão 40 x 41 como um decimal codificado com ASCII - o mesmo que quotDECquot Serial. Impressão 40 quot t quot 41 imprime um separador Serial. Impressão 40 x. DEC 41 imprimir como um serial decimal codificado com ASCII. Impressão 40 quot t quot 41 imprime um separador Serial. Impressão 40 x. HEX 41 imprimir como um ASCII-codificado hexadecimal Serial. Impressão 40 quot t quot 41 imprime um separador Serial. Impressão 40 x. O OCT 41 imprime como um serial Octal codificado em ASCII. Impressão 40 quot t quot 41 imprime um separador Serial. Println 40 x. BIN 41 imprimir como um binário codificado em ASCII, em seguida, adiciona o retorno de carro com quotprintlnquot atraso 40 200 41 atraso 200 milissegundos 125 Serial. Println 40 quotquot 41 imprime outro retorno de carro 125 Dicas de programação A partir da versão 1.0, a transmissão em série é assíncrona Serial. print () retornará antes que os caracteres sejam transmitidos. Claro, você pode usar a máscara primeiro e deslocar depois, a mesma coisa acontece - A máscara assegura que todos os outros bits são zero, o deslocamento move o valor assim que ele está no byte mais à direita do inteiro, portanto, no intervalo 0-255. 0xF8 por outro lado apenas manteria os 5 bits topmost do 8, assim que I39m não sure onde you39d achar que útil. Ndash xs0 25 de maio 11 às 15:29 está recebendo um dos componentes de cores (vermelho ou azul, esqueci qual). Se a máscara de cor não for executada, considere RGB (0, 127, 0) eo limiar 63. A chamada getRGB (.) Retornaria Qual é claramente mais do que o limiar 63. Mas a intenção era ignorar as outras duas cores Canais. A bitmask obtém apenas os 8 bits mais baixos, com zero. Está verificando se a cor é mais brilhante do que um limiar específico, b. Se o limite for excedido, o pixel é colorido de branco, usando de outra forma é colorido preto, usando So é uma conversão para preto e branco com base em um limiar pixel por pixel simples em um único canal de cor. Respondeu 25 de maio 11 às 14:57 obrigado, sim, eu simplesmente não vejo por que essa parte está lá ndash Lunar 25 de maio 11 às 14:58 Atualizado a resposta para explicar o bitmask ndash Dilum Ranatunga 25 de maio 11 às 15:03 Provavelmente porque Há alguma conversão para ou da ARGB. Esta é uma boa postagem do blog sobre o porquê de fazer operações bit-wise para cores. Respondeu 25 de maio 11 às 14:59 Ligação muito útil. Este link liberou mais conceito sobre operações bit-bit. ) Ndash iankits May 25 11 at 15:06 O valor RGB é um número inteiro por isso é representado na memória por 4 bytes (ou equivalentemente 32 bits). Cada byte representa um componente da cor: 1º byte: valor alfa (00000001 no exemplo) que corresponde à opacidade 2º byte: valor vermelho (00000010 no exemplo) 3º byte: valor verde (00000011 no exemplo) 4º byte: Valor azul (00000100 no exemplo) 0xff e 0xffffff símbolos 0xff representa o valor hexadecimal FF que é igual ao inteiro 255. Sua representação binária é: Similarmente 0xffffff é representado por: Corresponde à cor branca (vermelho, verde e azul igual Para 255). O operador binário e o amplificador são aplicados em dois inteiros i1 e i2 (i1 amp. I2). Ele retorna um inteiro com todos os seus bits iguais a 0, exceto os que são iguais a 1 nos i1 e i2. Por exemplo, se aplicarmos um amplificador no meu primeiro exemplo e no 0xff, obtemos: como conseqüência, (amp 0xff) permite apenas manter os valores do último byte (ou seja, o valor do componente azul da cor).Patch Regtool: Adicionar comandos de carga de carga e --binary option o patch anexado adiciona quotloadquot e quotunloadquot e opções quot-b, --binaryquot to regtool. Carregar um ramo de registro de PATH em novo SUBKEY: carga de regtool KEYSUBKEY PATH Descarregue e remova SUBKEY mais tarde: regtool descarregar KEYSUBKEY Imprimir o valor REGBINARY como hex: regtool - b obter KEYVALUE Definir valor REGBINARY de hex args: regtool - b set KEYVALUE XX XX XX XX . Exemplo: Suponha que S: é uma partição em um segundo HD que contém uma cópia de todos os arquivos da partição do sistema XP C :. O script a seguir corrige os mapeamentos de unidade lógica da instalação de backup. Isso permite inicializar a unidade de backup S: como C: depois que a unidade original C: foi removida. Load backup SYSTEM hive como SYSTEM. TMP regtool carregar HKLMSYSTEM. TMP cygdrivesWINDOWSsystem32configsystem armadilha regtool descarregar HKLMSYSTEM. TMP ERR Remover todos os mapeamentos de unidade lógica em backup (Algo complicado, porque os nomes de valor de chave contêm barras invertidas) para v em (regtool lista HKLMSYSTEM. TMPMountedDevices sed - N DosDevicesC-Z: s ,,, gp) do regtool - K, desarmado quotHKLMSYSTEM. TMPMountedDevices, vquot feito Mapa atual S: como C: no backup m (regtool - K, - b obter HKLMSYSTEMMountedDevices, DosDevicesS :) regtool - K, - b definir HKLMSYSTEM. TMPMountedDevices, DosDevicesC: m Descarregue a armadilha de colmeia ERR regtool descarregar HKLMSYSTEM. TMP Obrigado por qualquer comentário --- regtool. cc. orig 2005-09-12 01: 48: 05.001000000 0200 regtool. cc 2006-01-24 15: 48: 55.750000000 0100 -10,15 10,17 incluir ltstdio. hgt incluir ltstdlib. hgt incluir lterrno. hgt incluir ltctype. hgt incluir ltgetopt. hgt incluir ltwindows. hgt incluir ltsyscygwin. hgt enum - KTAUTO, KTINT, KTSTRING, KTEXPAND , KTMULTI KTAUTO, KTBINARY, KTINT, KTSTRING, KTEXPAND, KTMULTIK Eytype KTAUTO char keysep DEFAULTKEYSEPARATOR -32,6 34,7 - static char opts quotehiklmpqsvVK: quot static char opts quotbehiklmpqsvVK: quot int listwhat 0 int postfix 0 -62,7 65,7 uso (FILE where stderr) fprintf (onde, quotquot - QuotUsage: s OPTION (add check getlist remove unset) KEYnquot quotUsage: s OPTION (addcheckgetlistremoveunsetloadunload) KEYnquot quotView ou edite o Win32 registrynquot quotnquot quotquot, progname) -76,6 79,8 quot remove KEY remove KEYnquot quot set KEYVALUE data. Set VALUEnquot quot unset KEYVALUE remove VALUE de KEYnquot quot load KEYSUBKEY PATH carga hive de PATH em novo SUBKEYnquot quot unload KEYSUBKEY descarrega hive e remove SUBKEYnquot quotnquot) fprintf (onde, quotquot quotOptions para lista Action: nquot -83,7 88,11 quot - L, --list print only VALUEsnquot quot - p, --postfix como ls - p, anexa postfix para KEY namesnquot quotnot quotOptions for get Action: nquot quot - b, --Binary print REGBINARY data como hex bytesnquot quotnquot quotOptions para set Action : Nquot quot - b, - tipo de conjunto binário para REGBINARYnquotot - e, --expand-string set type para REGEXPANDSZnquot quot - i, --integer set type to REGDWORDnquot quot - m, --multi-string set type para REGMULTISZnquot (Base, n, 0, acesso, ampkey) - if (rv ERRORSUCCESS) - Falha (rv) se (acesso) rv RegOpenKeyEx (base, n, 0, Amp) se (rv ERRORSUCCESS) Falha (rv) else se (argv1) char win32pathMAXPATH cygwinconvtowin32path (argv 1, win32path) rv RegLoadKey (base, n, win32path) se (rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey s carregado do arquivo snquot, n, win32path) else rv RegUnLoadKey (base, n) if (rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey s unloadednquot, n) printf (quotkey s value snquot, n, value) -491,7 521,7 int i, n DWORD v, rv - char a argv1, dados Char a argv1, data 0 findkey (2, KEYALLACCESS) se (keytype KTAUTO) -510,6 540,27 switch (keytype) caso KTBINARY: para (n 0 argvn1 n) se (n gt 0) dados (char) malloc ( N) para (i 0 i lt ni) char e errno 0 v strtoul (argvi1, ampe, 16) se (errno v gt 0xff e) fprintf (stderr, quotInvalid hex constant snquot, argvi1) V rv RegSetValueEx (chave, valor, 0, REGBINARY, dados (const BYTE), n) caso de interrupção KTINT: v strtoul (a, 0, 0) rv RegSetValueEx (chave, valor, 0, REGDWORD, (const BYTE) ampv, -542,6 593,9 rv ERRORINVALIDCATEGORY quebra se (dados) livre (dados) if (r V ERRORSUCCESS) Fail (rv) -577,7 631,14 switch (vtype) case REGBINARY: - fwrite (dados, dsize, 1, stdout) se (keytype KTBINARY) hack para (não assinado i 0 i lt dsize i) printf ( Quot02xcquot, (char não assinado) datai, (i lt dsize-1. . N)) else fwrite (dados, dsize, 1, stdout) break caso REGDWORD: printf (quotlunquot, (DWORD) dados) -610,6 671,31 return 0 -642,6 730,9 enquanto (g getoptlong (argc , Argv, opts, longopts, NULL)) EOF) switch (g) caso b: keytype KTBINARY break case e: keytype KTEXPAND break On Jan 24 21:00, Christian Franke escreveu: gt Oi, gt gt o patch anexado adiciona quotloadquot comandos E quotunloadquot e opções quot-b, gt --binaryquot to regtool. Gt gt Carregar uma ramificação de registro de PATH em novo SUBKEY: gt gt regtool load KEYSUBKEY PATH gt gt Descarregar e remover SUBKEY mais tarde: gt gt regtool descarregar KEYSUBKEY gt gt Imprimir o valor REGBINARY como hex: gt gt regtool - b obter KEYVALUE gt gt Definir REGBINARY Valor de hex args: gt gt regtool - b set KEYVALUE XX XX XX XX. Gt gt gt Exemplo: gt Suponha que S: é uma partição em um segundo HD que contém uma cópia de todos os arquivos gt da partição do sistema XP C :. Gt O script a seguir corrige os mapeamentos de unidade lógica da instalação de backup gt. Gt Isso permite inicializar a unidade de backup S: como C: depois que a unidade C: original foi removida. Gt gt binsh gt set - e gt gt Carregar backup Backup do sistema como SYSTEM. TMP gt regtool carregar HKLMSYSTEM. TMP cygdrivesWINDOWSsystem32configsystem gt trap regtool descarregar HKLMSYSTEM. TMP ERR gt gt Remover todos os mapeamentos de unidade lógica no backup gt (Algo complicado, porque os nomes dos valores das chaves Contém barras invertidas) gt para v in (lista de regra geral HKLMSYSTEM. TMPMountedDevices gt sed - n DosDevicesC-Z: s ,,, gp) gt do gt regtool - K, desarmado quotHKLMSYSTEM. TMPMountedDevices, vquot gt feito gt gt Mapa atual S: como C : Em backup gt m (regtool - K, - b get HKLMSYSTEMMountedDevices, DosDevicesS :) gt regtool - K, - b conjunto HKLMSYSTEM. TMPMountedDevices, DosDevicesC: m gt gt Unload hive gt armadilha ERR gt regtool descarregar HKLMSYSTEM. TMP gt gt Fim de Script gt gt gt gt Obrigado por qualquer comentário Obrigado por este patch, parece muito útil. Falta apenas duas coisas. Em primeiro lugar, poderia criar uma entrada MatchLog correspondente Segundo, pior, eu não vejo seu nome na lista de pessoas com uma designação de direitos autorais no lugar, o que é definitivamente necessário para um patch desse tamanho. Precisamos de uma atribuição de direitos autorais escrita de você uma vez, depois disso, você pode criar tantos patches quanto quiser. Consulte cygwincontrib. html para obter os detalhes sangrentos sobre o formulário de atribuição de direitos autorais e como enviá-lo para a Red Hat. - Corinna Vinschen Por favor, envie e-mails sobre Cygwin para Cygwin Projeto Co-Líder cygwin AT cygwin DOT com Red Hat Abrir este post na exibição threaded Denunciar Conteúdo como Inadequado Re: Patch regtool: Adicionar comandos loadunload e opção binária On Wed, 25 Jan 2006, Corinna Vinschen escreveu: gt Em 24 de janeiro 21:00, Christian Franke escreveu: gt gt Oi, gt gt gt gt o patch anexado adiciona comandos quotloadquot e quotunloadquot e opções quot-b, gt gt --binaryquot para regtool. Gt gt gt gt Carregar uma ramificação de registro de PATH em novo SUBKEY: gt gt gt gt carga de regtool KEYSUBKEY PATH gt gt gt gt gt descarregar e remover SUBKEY mais tarde: gt gt gt gt regtool descarregar KEYSUBKEY gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt Gt gt gt regtool - b obter KEYVALUE gt gt gt gt gt gt Definir o valor REGBINARY a partir de hex args: gt gt gt gt regtool - b set KEYVALUE XX XX XX XX. Obrigado por qualquer comentário gt gt Obrigado por este patch, parece muito útil. Gt snip Gostaria de saber se seria melhor usar stdinstdout para dados binários (ou até mesmo adicionar uma opção-f para o conjunto). IMHO, regtool - b obter KEY1VALUE regtool - b set KEY2VALUE regtool - b obter KEY1VALUE regtool - b set - f - KEY2VALUE parece mais limpo do que armazenar a codificação hexadecimal em uma string. Se você quiser um despejo hexadecimal, regtool - b get KEY1VALUE od - t x1 irá fazê-lo. Eu não estou ciente de qualquer programa que faz o inverso (hex dump-gtbinary), mas escrever um script perl para que seja trivial. Dito isto, também acho que essa funcionalidade seria muito útil. Igor - cs. nyu. edu quotLas je suis sot. - Mais non, tu ne les pas, puisque tu tens rendes compte. quot Mas não - não és tolo te chamas de idiota, há provas suficientes nisso - Rostand, quotCyrano de Bergeracquot Em resposta a este post de Igor Peshansky Igor Peshansky escreveu: gtgtsnip gtgt gtgt gt gtI me pergunto se seria melhor usar stdinstdout para dados binários (ou gteven adicionar uma opção - f para o conjunto). IMHO, gt gtregtool - b obter KEY1VALUE regtool - b set KEY2VALUE gt gtor gt gtregtool - b obter KEY1VALUE regtool - b set - f - KEY2VALUE gt gtlooks mais limpo do que armazenar a codificação hexadecimal em uma corda. Gt Pelo menos quando o regtool é usado interativamente, é IMO não muito útil ter saída de ruído de linha de modem para REGBINARY, mas saída legível para os outros tipos de valores. Mas este é o comportamento atual do quotregtool get. Quot. Sugerir para combinar o melhor dos dois mundos: regtool get KEYVALUE deve sempre produzir saída legível humana, em especial um despejo hexadecimal para REGBINARY. (Mas isso mudaria o comportamento existente no REGBINARY) regtool - b get KEYVALUE grava REGBINARY como dados binários para stdout. Regtool - b set KEYVALUE 01 02 03 define o valor REGBINARY de bytes hexadecimais em args. Regtool - b set KEYVALUE - ajuste o valor de dados binários lidos de stdin gt. Gt gt gtThat disse, eu também acho que esta funcionalidade seria muito útil. Gt gt No mínimo, quando regtool é usado de forma interativa, é IMO não é muito útil gt gt para ter modem de linha ruído de saída para REGBINARY, Mas gt gt legível saída para os outros tipos de valor. Mas este é o comportamento gt gt atual de quotregtool get. Quot. Gt gt Em vez de uma bandeira - b explícita, talvez devesse chamar isatty () e gt se estiver sendo executado de forma interativa, produzir um despejo hexadevel legível para humanos, caso contrário o binário bruto de saída gt. E se você quiser redirecionar o despejo hexadecimal para um arquivo IMO, as verificações isatty () só são úteis se a saída não mudar qualitativamente no redirecionamento (por exemplo, para colorir). Caso contrário, é sempre melhor usar uma bandeira explícita. Dito isto, tentar fazer quotregtool obter um valor binário não é diferente de tentar gerar um arquivo binário - e não estavam mudando quotcatquot para saída de despejo hexadecimal. O que seria útil em vez disso é uma maneira de consultar o tipo de um valor via regtool. Poderíamos também adicionar um quot-hquot (para - legível para humanos) para sempre produzir o valor em forma legível por humanos (veja abaixo). FWIW, Aregtool obtém KEYTOVAL regtool set KEY2VAL quotAquot já vai pausar para os valores do tipo REGMULTISZ. Seria bom fazer o comportamento de regtools consistente: quotregtool set - f FILEquot lê o valor de FILE, que funcionaria para todos os tipos de valor. Igor - cs. nyu. edu quotLas je suis sot. - Mais não, tu ne les pas, come tu ten rends compte. quot quot Mas não - você não é tolo, você se chama um tolo, há prova suficiente disso - Rostand, quotCyrano de Bergeracquot Abra esta postagem em exibição threaded Denuncie Conteúdo Como Reposição inapropriada: Patch regtool: Adicionar comandos de carga de carga e - opção binária Igor Peshansky escreveu: gt E se você quiser redirecionar o despejo hexadecimal para um arquivo IMO, as verificações isatty () são úteis somente se a saída não se altera qualitativamente no redirecionamento Gt (eg para coloração). Caso contrário, é sempre melhor usar uma bandeira gt explícita. Bom ponto. Por que nós apenas emulamos o comportamento do gato aqui Se isatty () for verdadeiro e os caracteres não-ascii estiverem na saída, então pregunte antes de possivelmente fubar o terminal de usuários, caso contrário, simplesmente exiba os dados brutos. E assim como o gato não tem nenhum código interno para formatar dados binários como um despejo hexadecimal, nem deve regtool, já que o od funciona perfeitamente para isso e já possui a verdadeira pia de cozinha das opções de formatação. Re: Patch regtool: Adicionar comandos loadunload e - opção binária Em resposta a este post por Christian Franke Em 25 de janeiro 21:58, Christian Franke escreveu: gt Vai enviar o snail mail com o Material legal em breve -) Obrigado, estou ansioso. Desculpe pelo aborrecimento, mas ainda não obtivemos permissão legal para um método mais simples. Por favor seja paciente, isso pode levar algum tempo. - Corinna Vinschen Por favor, envie e-mails sobre Cygwin para Cygwin Projeto Co-Líder cygwin AT cygwin DOT com Red Hat Abra este post na visualização thread Report Conteúdo como Inadequado Re: Patch regtool: Adicionar comandos loadunload e opção binária On Jan 26 10 : 19, Corinna Vinschen escreveu: gt Em 25 de janeiro 21:58, Christian Franke escreveu: gt gt enviará o snail mail com o material legal em breve -) gt gt Obrigado, estou ansioso. Desculpe pelo aborrecimento, mas ainda não obtivemos autorização legal para um método mais simples. Gt gt Por favor, seja paciente, isso pode levar algum tempo. Sua tarefa finalmente chegou e é assinada. Você tem uma nova versão do seu patch regtool disponível, após esta discussão teve lugar - Corinna Vinschen Por favor, envie e-mails sobre Cygwin para Cygwin Projeto Co-Líder cygwin AT cygwin DOT com Red Hat Abrir este post na exibição threaded Denunciar Conteúdo como Inadequado Re: Patch regtool: Adicionar comandos de carga de carga e - opção binária gt Oi Cristão, gt gt Em 26 de janeiro 10:19, Corinna Vinschen escreveu: gt gtgt Em 25 de janeiro 21:58, Christian Franke escreveu: gtgt gtgtgt enviará o snail mail Com o assunto legal em breve -) gtgtgt gtgt Obrigado, estou ansioso. Desculpe pelo aborrecimento, mas ainda não conseguimos autorização legal para um método mais simples. Gtgt gtgt Por favor, seja paciente, isso pode levar algum tempo. Gtgt gt gt sua tarefa finalmente chegou e é assinado. Você tem uma nova versão do seu patch regtool disponível, depois desta discussão gt ocorreu gt Não, desculpe. Espero encontrar algum tempo em cerca de uma semana. Ainda não tenho certeza de como lidar com os valores do registro binário de uma maneira mais útil dentro dos scripts. Re: Patch regtool: Adicionar comandos loadunload e - opção binária Em 13 de fevereiro de 20:43, Christian Franke escreveu: gt você escreveu: gt gtyour atribuição finalmente chegou e é assinado. Você tem uma nova versão gt do seu patch regtool disponível, depois desta discussão gt gttook place gt gt Não, desculpe. Espero encontrar algum tempo em cerca de uma semana. Gt gt Ainda não tenho certeza de como manipular os valores do registro binário de uma maneira que a maioria dos gt seja útil dentro dos scripts. Por padrão, dados binários devem ir como dados binários sobre o pipe. E isso é tudo o que é necessário, em teoria, já que existem ferramentas como xxd. - Corinna Vinschen Por favor, envie e-mails sobre Cygwin para Cygwin Project Co-Líder cygwin AT cygwin DOT com Red Hat Attached é a versão 2 do patch, incluindo uma atualização do utils. sgml REGBINARY agora pode ser eer ler como binário do stdin: eco 0: 01 02 FE FF xxd - r regtool - b set KEYBINVALUE - regtool obter KEYBINVALUE regtool - b set KEYBINVALUE - ou especificado como argumentos hexadecimais: regtool - b set KEYBINVALUE 01 02 FE FF x (regtool - b get KEYBINVALUE) regtool - b Set KEYBINVALUE x As ações do loadunload permanecem inalteradas. 2006-03-01 Christian Franke lthidden email gt regtool. cc: Adicionar ações loadunload e opção - b, --binary. Utils. sgml (regtool): documente-o. Índice: regtool. cc Arquivo RCS: cvssrcsrcwinsuputilsregtool. cc, v recuperando revisão 1.19 diff - u - r1.19 regtool. cc --- regtool. cc 15 de fevereiro de 2006 10:57:17 -0000 1.19 regtool. cc 1 de março de 2006 18 : 35: 01 -0000 -10,15 10,17 incluir ltstdio. hgt incluir ltstdlib. hgt incluir lterrno. hgt incluir ltctype. hgt incluir ltgetopt. hgt incluir ltwindows. hgt incluir ltsyscygwin. hgt enum - KTAUTO, KTINT, KTSTRING, KTEXPAND , KTMULTI KTAUTO, KTBINARY, KTINT, KTSTRING, KTEXPAND, KTMULTI tipo de chave KTAUTO char keysep DEFAULTKEYSEPARATOR -32,6 34,7 - static char opts quotehiklmpqsvVK: quot estático char opts quotbehiklmpqsvVK: quot int listwhat 0 int postfix 0 -62,7 65, 7 uso (FILE onde stderr) fprintf (onde, quotquot - quotUsot: s OPÇÃO (adicionar check get list remover unset) KEYnquot quotUsage: s OPÇÃO (addcheckgetlistremoveunsetloadunload) KEYnquot quotView ou editar o Win32 registrynquot quotnquot quotquot, progname) , 8 quot remove KEY removeQuando define os dados KEYVALUE. Set VALUEnquot quot unset KEYVALUE remove VALUE de KEYnquot quot load KEYSUBKEY PATH carga hive de PATH em novo SUBKEYnquot quot unload KEYSUBKEY descarrega hive e remove SUBKEYnquot quotnquot) fprintf (onde, quotquot quotOptions para lista Action: nquot -83,7 88,11 quot - L, --list print only VALUEsnquot quot - p, --postfix como ls - p, anexa postfix para KEY namesnquot quotnot quotOptions for get Action: nquot quot - b, --Binary print REGBINARY data como hex bytesnquot quotnquot quotOptions para set Action : Nquot - b, --binary set type para REGBINARY (hex args ou -) nquot quot - e, --expand-string set type para REGEXPANDSZnquot quot - i, - enterger set type para REGDWORDnquot quot - m, - Tipo de conjunto de várias cadeias para REGMULTISZnquot -348,9 357,30 base de teclas else - rv RegOpenKeyEx (base, n, 0, acesso, ampkey) - se (rv ERRORSUCCESS) - Falha (rv) se (acesso) rv RegOpenKeyEx (base , N, 0, acesso, ampkey) se (rv ERRORSUCCESS) Fail (rv) else if (argv1) char win32pathMAXPATH cygwinconv Towin32path (argv1, win32path) rv RegLoadKey (base, n, win32path) se (rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey s carregado do arquivo snquot, n, win32path) else rv RegUnLoadKey (base, n) se (Rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey s unloadednquot, n) printf (quotkey s value snquot, n, value) -491,7 521,7 int i, n DWORD v, rv - char a argv1 , Dados char a argv1, dados 0 findkey (2, KEYALLACCESS) se (keytype KTAUTO) -510,6 540,43 switch (keytype) caso KTBINARY: para (n 0 argvn1 n) se (n 1 ampamp strcmp (argv1, quot 0) em 0 para () if (i ltn) em dados BUFSIZ (char) realloc (dados, i) int r fread (datan, 1, in, stdin) (N gt 0) dados (char) malloc (n) para (i 0 i lt ni) char e errno 0 v strtoul (argvi1, ampe, 16) se (errno v gt 0xff e) fprintf (stderr, quotInvalid hex constant snquot , Argvi1) exit (1) datai (char) v rv RegSetValueEx (chave, valor, 0, REGBINARY, (const BYTE) dados, n) break case KTINT: v strtoul (a, 0, 0) rv RegSetValueEx (chave, valor, 0, REGDWORD, (const BYTE) ampv, -542,6 609,9 rv (Rv) -577,7 647,14 switch (vtype) caso REGBINARY: - fwrite (dados, dsize, 1, stdout) se (keytype KTBINARY) hack Para (não assinado i i i dt i) printf (quot02xcquot, (design não assinado) datai, (i lt dsize-1. . N)) else fwrite (dados, dsize, 1, stdout) break caso REGDWORD: printf (quotlunquot, (DWORD) dados) -610,6 687,31 return 0 -642,6 746,9 enquanto (g getoptlong (argc , Argv, opts, longopts, NULL)) EOF) switch (g) caso b: keytype KTBINARY break case e: keytype KTEXPAND break Índice: utils. sgml Arquivo RCS: cvssrcsrcwinsuputilsutils. sgml, v recuperando revisão 1.58 diff - u - r1. 58 utils. sgml --- utils. sgml 16 Feb 2006 11:17:19 -0000 1.58 utils. sgml 1 de março de 2006 18:35:09 -0000 -1023,7 1023,7 ltsect2 idquotregtoolquotgtlttitlegtregtoollttitlegt ltscreengt - Usage: regtool. exe OPTION (adicionar check get list remover unset) KEY Uso: regtool OPTION (addcheckgetlistremoveunsetloadunload) KEY Exibir ou editar o registro Win32 Ações: -1034,13 1034,19 remover KEY remover KEY definir dados KEYVALUE. Set VALUE unset KEYVALUE remove VALUE da carga KEY KEYSUBKEY PATH carrega o hive de PATH para o novo SUBKEY descarrega KEYSUBKEY descarrega o hive e remove SUBKEY Opções para a lista Action: - k, --keys print only KEYs - l, --list print only VALUEs - p , --postfix como ls - p, anexa postfix aos nomes KEY Opções para obter Ação: - b, --binary print Dados REGBINARY como bytes hexadecimais Opções para set Action: - b, --binary set type para REGBINARY (hex args ou -) - e, --expand-string conjunto tipo para REGEXPANDSZ - i, --integer definir tipo para REGDWORD - m, --multi-string conjunto tipo para REGMULTISZ -1109,6 1115,10 ltparagt ltparagtThe ltliteralgtsetltliteralgt ação define um valor Dentro de uma chave. Ltliteralgt-bltliteralgt significa seus dados binários (REGBINARY). Os valores binários são especificados como bytes hexadecimais na lista de argumentos. Se o argumento for ltliteralgt-ltliteralgt, os dados binários são lidos de stdin em vez disso. Ltliteralgt-eltliteralgt significa que é uma string em expansão (REGEXPANDSZ) que contém variáveis ​​de ambiente incorporadas. Ltliteralgt-iltliteralgt significa que o valor é um inteiro (REGDWORD). -1122,6 1132,13 A ação ltliteralgtunsetltliteralgt remove um valor de uma chave. Ltparagt ltparagt A ação ltliteralgtloadltliteralgt adiciona uma nova subchave e carrega o conteúdo de uma ramo de registro nela. A chave pai deve ser HKEYLOCALMACHINE ou HKEYUSERS. A ação ltliteralgtunloadltliteralgt descarrega o arquivo e remove a subchave. Ltparagt ltparagt Por padrão, o último quotquot ou quotquot é assumido como o separador entre a chave e o valor. Você pode usar a opção ltliteralgt-Kltliteralgt para fornecer On Mar 1 20:13, Christian Franke escreveu: gt Attached é a versão 2 do patch, incluindo uma atualização de utils. sgml gt gt REGBINARY agora pode ser ler ether como binário de stdin: Gt gt echo 0: 01 02 FE FF xxd - r regtool - b set KEYBINVALUE - gt gt regtool get KEYBINVALUE regtool - b set KEYBINVALUE - gt gt ou especificado como argumentos hexadecimais: gt gt regtool - b set KEYBINVALUE 01 02 FE FF gt gt X (regtool - b get KEYBINVALUE) gt regtool - b set KEYBINVALUE x gt gt gt As ações de carga de carga são inalteradas. Gt gt Christian gt gt gt gt 2006-03-01 Christian Franke lthidden email gt gt gt regtool. cc: Adicionar carga de ações e opção - b, - binário. Gt utils. sgml (regtool): Documentá-lo. Seu patch parece muito bom para mim, mas eu tenho algumas pequenas lêndeas. Primeiro, seja um pouco mais detalhado na sua entrada do ChangeLog. Adicione entradas explícitas para cada função alterada ou estrutura de dados global. Gt recuperando a revisão 1.19 gt diff - u - r1.19 regtool. cc Você pode usar o diff - up Isso ajuda (pelo menos eu) a navegar por um patch. Gt cygwinconvtowin32path (argv1, win32path) Isso acontece um par de vezes. Quando você está chamando funções, você poderia sempre adicionar um espaço entre o nome da função eo parêntese de abertura gt rv RegLoadKey (base, n, win32path) gt printf (quotkey s valor snquot, n, valor) Por que é printf comentado Se o seu Não necessário, remova. Gt -577,7 647,14 gt gt gt caso REGBINARY: gt - fwrite (dados, dsize, 1, stdout) gt se (keytype KTBINARY) hack Hack Por que hack Caso contrário, por favor, remova este comentário. - Corinna Vinschen Por favor, envie e-mails sobre Cygwin para Cygwin Project Co-Líder cygwin AT cygwin DOT com Red Hat Corinna Vinschen escreveu: gt. Gt gtgt printf (quotkey s value snquot, n, value) gtgt gt gt Por que este printf é comentado Se não for necessário, remova. Gt cvs anotate regtool. cc. 1.1 (cgf 17-fev-00): 1.1 (cgf 17-fev-00): printf (quotkey s value snquot, n, value) 1.1 (cgf 17-Fev-00): Fazer código-janitor trabalho em código histórico foi Não é a intenção do meu patch -) Desconsiderar essa linha durante o teste foi útil, então deixei-o intocado. Gtgt -577,7 647,14 gtgt switch (vtype) gtgt gtgt case REGBINARY: gtgt - fwrite (dados, dsize, 1, stdout) gtgt if (keytype KTBINARY) hack gtgt gt gt Hack Por que invadir, caso contrário, remova este comentário. Gt Porque usando quotsetquot keytype para como uma opção quotgetquot foi chamado um hack há muitos anos: 1.1 (cgf 17-Fev-00): case REGEXPANDSZ: 1.3 (cgf 10-Jan-01): if (keytype KTEXPAND) hack 1.1 Cgf 17-Fev-00): Anexado é uma nova versão do patch. Graças à sua ajuda sobre SEBACKUPNAME, a ação quotsavequot está agora incluída. Exemplo: colmeias de registro do sistema de backup (aka esses arquivos feios para bloqueio para sempre no windowssystem32config -) para k no SAM SISTEMA DE SOFTWARE DE SEGURANÇA fazer regtool salvar HKLMk quotdkquot feito regtool salvar HKU. DEFAULT quotdDEFAULTquot Fim do script Espero que os novos recursos sejam úteis. 2006-03-02 Christian Franke lthidden email gt regtool. cc (opções): Adicionar binário. (Uso): Documento loadunloadsave e - b. (Findkey): adicione o parâmetro de opções, adicione carga de carga. (Cmdset): adicione o caso KTBINARY. (Cmdget): Adicionar saída hex no caso KTBINARY. (Cmdload): Nova função. (Cmdunload): Nova função. (Setprivilege): Nova função. (Cmdsave): Nova função. (Comandos): Adicionar carga, descarregar e salvar. (Principal): adicione - b utils. sgml (regtool): documente-o. Index: regtool. cc RCS arquivo: cvssrcsrcwinsuputilsregtool. cc, v recuperando revisão 1.19 diff - u - p - r1.19 regtool. cc --- regtool. cc 15 Fev 2006 10:57:17 -0000 1.19 regtool. cc 2 Mar 2006 20:46:24 -0000 -10,15 10,17 detalhes. Incluem ltstdio. hgt incluem ltstdlib. hgt incluem lterrno. hgt incluem ltctype. hgt incluem ltgetopt. hgt incluem ltwindows. hgt incluem ltsyscygwin. hgt enum - KTAUTO, KTINT, KTSTRING, KTEXPAND, KTMULTI KTAUTO, KTBINARY, KTINT, KTSTRING, KTEXPAND, KTMULTI Keytype KTAUTO char keysep DEFAULTKEYSEPARATOR -32,6 34,7 estático char progname - static char opts quotehiklmpqsvVK: quot estático char opts quotbehiklmpqsvVK: quot int listwhat 0 int postfix 0 -62,7 65,7 estático void uso (FILE onde stderr) fprintf (where, quotquot - quotUsage: s OPTION (add check get list remove unset) KEYnquot quotUsage: s OPTION (addcheckgetlistremoveunsetloadunloadsave) KEYnquot quotView or edit the Win32 registrynquot quotnquot quotquot, progname) -76,6 79,9 usage (FILE where stderr) quot remove KEY remove KEYnquot quot set KEYVALUE data. set VALUEnquot quot unset KEYVALUE removes VALUE from KEYnquot quot load KEYSUBKEY PATH load hive from PATH into new SUBKEYnquot quot unload KEYSUBKEY unload hive and remove SUBKEYnquot quot save KEYSUBKEY PATH save SUBKEY into new hive PATHnquot quotnquot) fprintf (where, quotquot quotOptions for list Action:nquot -83,7 89,11 usage (FILE where stderr) quot - l, --list print only VALUEsnquot quot - p, --postfix like ls - p, appends postfix to KEY namesnquot quotnquot quotOptions for get Action:nquot quot - b, --binary print REGBINARY data as hex bytesnquot quotnquot quotOptions for set Action:nquot quot - b, --binary set type to REGBINARY (hex args or -)nquot quot - e, --expand-string set type to REGEXPANDSZnquot quot - i, --integer set type to REGDWORDnquot quot - m, --multi-string set type to REGMULTISZnquot -265,7 275,7 translate (char key) void - findkey (int howmanyparts, REGSAM access) findkey (int howmanyparts, REGSAM access, int option 0) HKEY base int rv -348,9 358,44 findkey (int howmanyparts, REGSAM acces key base else - rv RegOpenKeyEx (base, n, 0, access, ampkey) - if (rv ERRORSUCCESS) - Fail (rv) if (access) rv RegOpenKeyEx (base, n, 0, access, ampkey) if (option ampamp (rv ERRORSUCCESS rv ERRORACCESSDENIED)) reopen with desired option due to missing option support in RegOpenKeyE FIXME: may create the key in rare cases (e. g. access denied in parent) HKEY key2 if (RegCreateKeyEx (base, n, 0, NULL, option, access, NULL, ampkey2, NULL) ERRORSUCCESS) if (rv ERRORSUCCESS) RegCloseKey (key) key key2 rv ERRORSUCCESS if (rv ERRORSUCCESS) Fail (rv) else if (argv1) char win32pathMAXPATH cygwinconvtowin32path (argv1, win32path) rv RegLoadKey (base, n, win32path) if (rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey s loaded from file snquot, n, win32path) else rv RegUnLoadKey (base, n) if (rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey s unloadednquot, n) printf(quotkey s value snquot, n, value) -491,7 536,7 cmdset () int i, n DWORD v, rv - char a argv1, data char a argv1, data 0 findkey (2, KEYALLACCESS) if (keytype KTAUTO) -510,6 555,43 cmdset () switch (keytype) case KTBINARY: for (n 0 argvn1 n) if (n 1 ampamp strcmp (argv1, quot-quot) 0) i n 0 for () if (i lt n) i n BUFSIZ data (char ) realloc (data, i) int r fread (d atan, 1, i-n, stdin) if (r lt 0) break n r else if (n gt 0) data (char ) malloc (n) for (i 0 i lt n i) char e errno 0 v strtoul (argvi1, ampe, 16) if (errno v gt 0xff e) fprintf (stderr, quotInvalid hex constant snquot, argvi1) exit (1) datai (char) v rv RegSetValueEx (key, value, 0, REGBINARY, (const BYTE ) data, n) break case KTINT: v strtoul (a, 0, 0) rv RegSetValueEx (key, value, 0, REGDWORD, (const BYTE ) ampv, -542,6 624,9 cmdset () rv ERRORINVALIDCATEGORY break if (data) free(data) if (rv ERRORSUCCESS) Fail (rv) -577,7 662,14 cmdget () switch (vtype) case REGBINARY: - fwrite (data, dsize, 1, stdout) if (keytype KTBINARY) hack for (unsigned i 0 i lt dsize i) printf (quot02xcquot, (unsigned char)datai, (i lt dsize-1. . n)) else fwrite (data, dsize, 1, stdout) break case REGDWORD: printf (quotlunquot, (DWORD ) data) -610,6 702,72 cmdget () return 0 int cmdload () if (argv1) usage () return 1 findkey (1, 0) return 0 int cmdunload () if (argv1) usage () return 1 findkey (1, 0) return 0 DWORD setprivilege (const char name) TOKENPRIVILEGES tp if (LookupPrivilegeValue (NULL, name, amptp. Privileges0.Luid)) return GetLastError () tp. PrivilegeCount 1 tp. Privileges0.Attributes SEPRIVILEGEENABLED HANDLE t OpenProcessToken does not work here, because main thread has its own impersonation token if (OpenThreadToken (GetCurrentThread (), TOKENADJUSTPRIVILEGES, FALSE, ampt)) return GetLastError () AdjustTokenPrivileges (t, FALSE, amptp, 0, NULL, NULL) DWORD rv GetLastError () CloseHandle (t) return rv int cmdsave () if (argv1) usage () return 1 try to set SeBackupPrivilege, let RegSaveKey report the error setprivilege (SEBACKUPNAME) REGOPTIONBACKUPREST ORE is necessary to save HKLMSECURITY findkey (1, KEYQUERYVALUE, REGOPTIONBACKUPRESTORE) char win32pathMAXPATH cygwinconvtowin32path (argv1, win32path) DWORD rv RegSaveKey (key, win32path, NULL) if (rv ERRORSUCCESS) Fail (rv) if (verbose) printf (quotkey saved to snquot, win32path) return 0 struct const char name -623,6 781,9 struct , , , , , , -642,6 803,9 main (int argc, char argv) while ((g getoptlong (argc, argv, opts, longopts, NULL)) EOF) switch (g) case b: keytype KTBINARY break case e: keytype KTEXPAND break Index: utils. sgml RCS file: cvssrcsrcwinsuputilsutils. sgml, v retrieving revision 1.58 diff - u - p - r1.58 utils. sgml --- utils. sgml 16 Feb 2006 11:17:19 -0000 1.58 utils. sgml 2 Mar 2006 20:46:30 -0000 -1023,7 1023,7 option. ltsect2 idquotregtoolquotgtlttitlegtregtoollttitlegt ltscreengt - Usage: regtool. exe OPTION (add check get list remove unset) KEY Usage: regtool OPTION (addcheckgetlistremoveunsetloadunloadsave) KEY View or edit the Win32 registry Actions: -1034,13 1034,20 Actions: remove KEY remove KEY set KEYVALUE data. set VALUE unset KEYVALUE removes VALUE from KEY load KEYSUBKEY PATH load hive from PATH into new SUBKEY unload KEYSUBKEY unload hive and remove SUBKEY save KEYSUBKEY PATH save SUBKEY into new hive PATH Options for list Action: - k, --keys print only KEYs - l, --list print only VALUEs - p, --postfix like ls - p, appends postfix to KEY names Options for get Action: - b, --binary print REGBINARY data as hex bytes Options for set Action: - b, --binary set type to REGBINARY (hex args or -) - e, --expand-string set type to REGEXPANDSZ - i, --integer set type to REGDWORD - m, --multi-string set type to REGMULTISZ -1109,6 1116,10 accidentally removing too much. ltparagt ltparagtThe ltliteralgtsetltliteralgt action sets a value within a key. ltliteralgt-bltliteralgt means its binary data (REGBINARY). The binary values are specified as hex bytes in the argument list. If the argument is ltliteralgt-ltliteralgt, binary data is read from stdin instead. ltliteralgt-eltliteralgt means its an expanding string (REGEXPANDSZ) that contains embedded environment variables. ltliteralgt-iltliteralgt means the value is an integer (REGDWORD). -1122,6 1133,17 a regular string. The ltliteralgtunsetltliteralgt action removes a value from a key. ltparagt ltparagtThe ltliteralgtloadltliteralgt action adds a new subkey and loads the contents of a registry hive into it. The parent key must be HKEYLOCALMACHINE or HKEYUSERS. The ltliteralgtunloadltliteralgt action unloads the file and removes the subkey. ltparagt ltparagtThe ltliteralgtsaveltliteralgt action saves a subkey into a registry hive. ltparagt ltparagt By default, the last quotquot or quotquot is assumed to be the separator between the key and the value. You can use the ltliteralgt-Kltliteralgt option to provide On Mar 2 21:59, Christian Franke wrote: gt Corinna Vinschen wrote: gt gt. gt gt gt gtgt printf(quotkey s value snquot, n, value) gt gtgt gt gt gt gtWhy is this printf commented out If its not needed, please remove. gt gt gt gt cvs annotate regtool. cc gt. gt 1.1 (cgf 17-Feb-00): gt 1.1 (cgf 17-Feb-00): printf(quotkey s value snquot, n, value) gt 1.1 (cgf 17-Feb-00): gt gt Doing code-janitor work on historic code was not the intent of my patch -) Urgh, sorry about that. While scanning your patch I missed that this printf isnt new but already in the code. gt gtgt -577,7 647,14 gt gtgt switch (vtype) gt gtgt gt gtgt case REGBINARY: gt gtgt - fwrite (data, dsize, 1, stdout) gt gtgt if (keytype KTBINARY) hack gt gtgt gt gt gt gtHack Why hack Otherwise, please remove this comment. gt gt gt gt Because using quotsetquot keytype for as a quotgetquot option has been gt called a hack many years ago: gt gt 1.1 (cgf 17-Feb-00): case REGEXPANDSZ: gt 1.3 (cgf 10-Jan-01): if (keytype KTEXPAND) hack gt 1.1 (cgf 17-Feb-00): Well, I cant see a hack in what youre using KTBINARY here. I removed the comment from your patch. gt Attached is a new version of the patch. gt Thanks to your help regarding SEBACKUPNAME, the quotsavequot action is now gt included. gt 2006-03-02 Christian Franke lthidden email gt gt gt regtool. cc (options): Add binary. gt (usage): Document loadunloadsave and - b. gt (findkey): Add options parameter, add loadunload. gt (cmdset): Add KTBINARY case. gt (cmdget): Add hex output in KTBINARY case. gt (cmdload): New function. gt (cmdunload): New function. gt (setprivilege): New function. gt (cmdsave): New function. gt (commands): Add load, unload and save. gt (main): Add - b gt utils. sgml (regtool): Document it. I applied the patch. I just had to reformat your ChangeLog slightly (a TAB before all lines, no extra indentation for lines which dont start with a ). Btw. since you seem to be interested in hacking the registry. would you also be interested to introduce registry write access below procregistry inside of the Cygwin DLL That would be extra cool. Im not quite sure how to handle the mapping from file types to registry key types, but there might be some simple way which Im just too blind to see. -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat On 03 March 2006 09:46, Corinna Vinschen wrote: gt gt Btw. since you seem to be interested in hacking the registry. would gt you also be interested to introduce registry write access below gt procregistry inside of the Cygwin DLL That would be extra cool. gt Im not quite sure how to handle the mapping from file types to gt registry key types, but there might be some simple way which Im just gt too blind to see. Hey, how about using pseudo filename-extensions on the pseudo-files that represent registry keys echo quotFooquot gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. sz creates procregistryHKEYCURRENTUSERSoftwareAppKeyValueName, type REGSZ, content quotFooltNULgtquot echo quotWINDIRquot gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. xsz creates procregistryHKEYCURRENTUSERSoftwareAppKeyValueName as REGEXPANDSZ echo quot23quot gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. dword echo quot0x17quot gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. dword dd bs1024 count3 ifdevrandom ofprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. bin etc etc. (We might even want a CYGWIN option to make the extension show up in dir listings, but it wouldnt be backwardly-compatible to do so in general). Hmm, and how about for MULTISZ taking account of the open mode echo quotString1quot gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz echo quotString2quot gtgtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz echo quotString3quot gtgtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz echo quotString4quot gtgtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz od - c lt procregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz String10String20String30String400 cheers, DaveK -- Cant think of a witty. sigline today. On Mar 3 13:12, Dave Korn wrote: gt On 03 March 2006 09:46, Corinna Vinschen wrote: gt gt gt gt gt Btw. since you seem to be interested in hacking the registry. would gt gt you also be interested to introduce registry write access below gt gt procregistry inside of the Cygwin DLL That would be extra cool. gt gt Im not quite sure how to handle the mapping from file types to gt gt registry key types, but there might be some simple way which Im just gt gt too blind to see. gt gt gt Hey, how about using pseudo filename-extensions on the pseudo-files that gt represent registry keys gt gt i. e gt gt echo quotFooquot gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. sz gt creates procregistryHKEYCURRENTUSERSoftwareAppKeyValueName, type gt REGSZ, content quotFooltNULgtquot gt gt echo quotWINDIRquot gt gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. xsz gt creates procregistryHKEYCURRENTUSERSoftwareAppKeyValueName as gt REGEXPANDSZ gt gt echo quot23quot gt gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. dword gt echo quot0x17quot gt gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. dword gt gt dd bs1024 count3 ifdevrandom gt ofprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. bin gt gt touch procregistryHKEYCURRENTUSERSoftwareAppKeyValueName. none gt gt etc etc. (We might even want a CYGWIN option to make the extension show up gt in dir listings, but it wouldnt be backwardly-compatible to do so in gt general). gt gt Hmm, and how about for MULTISZ taking account of the open mode gt gt echo quotString1quot gt gtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz gt echo quotString2quot gt gtgtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz gt echo quotString3quot gt gtgtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz gt echo quotString4quot gt gtgtprocregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz gt od - c lt procregistryHKEYCURRENTUSERSoftwareAppKeyValueName. msz gt String10String20String30String400 Thats actually an interesting idea. I was always thinking along the lines of using POSIX file types (plain, socket, pipe. ). However, file suffixes is something were already suffering from a lot (its not by chance that SUFFix and SUFFer are so similar, IMHO). What if a key quotfoo. szquot really exists and somebody wants to create a registry key quotfooquot When reading quotfooquot, which file is meant Whats the order of checking suffixes When somebody writes to a key quotfooquot, whats the default suffix, er. key type Or does that fail with an error message -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat Open this post in threaded view Report Content as Inappropriate RE: Patch regtool: Add loadunload commands and --binary option gt Thats actually an interesting idea. I was always thinking along gt the lines of using POSIX file types (plain, socket, pipe. ). gt gt However, file suffixes is something were already suffering from gt a lot (its not by chance that SUFFix and SUFFer are so similar, IMHO). Heh, yeh, who could ever forget the. exe. lnk. exe. lnk. lnk. exe troubles However, were in a special situation here, its not really a dir tree and the things in it arent really files, and we may be able to get away with it. I posted the idea so that others could see if it works or if they can see problems with the approach. gt What if a key quotfoo. szquot really exists and somebody wants to create gt a registry key quotfooquot No problem. If you want to create foo, you write to quotfoo. szquot. If you want to create foo. sz, you have to write to quotfoo. sz. szquot. Unless of course foo. sz is a dword, in which case youd write to quotfoo. sz. dwquot, etc etc. gt When reading quotfooquot, which file is meant There can only be one at a time, because in the registry there can only be one value with the name foo, regardless of what type it has. gt Whats the order of checking suffixes Im proposing that the suffix is only used when creating or writing to the file, to determine the type, but the suffix is stripped off for generating the actual name, and is not shown in dir listings, and is not required to open the file for read. gt When somebody writes to a key quotfooquot, whats the default suffix, gt er. key type Or does that fail with an error message Either I havent a strong opinion on the matter. cheers, DaveK -- Cant think of a witty. sigline today.

Comments

Popular Posts