ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2019
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
36 participants
217 discussions
Start a n
N
ew thread
[reactos] 02/13: [CALC] Improve multi-precision support, and powers/roots. CORE-8486
by Carlo-Bramini
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=295eaf4e326f9ac090402…
commit 295eaf4e326f9ac09040222833fcf58ee28fd107 Author: Carlo-Bramini <carlo_bramini(a)users.sourceforge.net> AuthorDate: Mon Aug 6 09:54:21 2018 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Mon Mar 18 01:34:00 2019 +0100 [CALC] Improve multi-precision support, and powers/roots. CORE-8486 - Added support for average of squares and mean of squares into statistical functions. - pop() and push() functions in RPN engines now work with nodes instead of stack units. - Moved the POW and SQR operations near the operators. CORE-12766 - Fix number of digits for IEEE-754 constants. - Show all available digits in exp notation. CORE-14871 - Update help correspondingly. --- base/applications/calc/calc.h | 27 +++++----- base/applications/calc/fun_ieee.c | 73 ++++++++++++++++++++++++-- base/applications/calc/fun_mpfr.c | 64 ++++++++++++++++++++++- base/applications/calc/help.txt | 10 +++- base/applications/calc/resource.h | 1 + base/applications/calc/rpn_ieee.c | 80 ++++++++++++++++++---------- base/applications/calc/rpn_mpfr.c | 106 ++++++++++++++++++++++---------------- base/applications/calc/utl_ieee.c | 58 ++++++++++++++------- base/applications/calc/utl_mpfr.c | 33 +++++++++--- base/applications/calc/winmain.c | 50 +++++++++--------- 10 files changed, 360 insertions(+), 142 deletions(-) diff --git a/base/applications/calc/calc.h b/base/applications/calc/calc.h index d1f23a2811..702ad47e77 100644 --- a/base/applications/calc/calc.h +++ b/base/applications/calc/calc.h @@ -11,6 +11,7 @@ #ifndef DISABLE_HTMLHELP_SUPPORT #include <htmlhelp.h> #endif +#include <limits.h> /* Messages reserved for the main dialog */ #define WM_CLOSE_STATS (WM_APP+1) @@ -21,8 +22,9 @@ #define WM_HANDLE_FROM (WM_APP+6) #define WM_HANDLE_TO (WM_APP+7) +/* GNU MULTI-PRECISION LIBRARY support */ #ifdef ENABLE_MULTI_PRECISION -#include <mpfr.h> +#include "mpfr.h" #ifndef MPFR_DEFAULT_RND #define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode () @@ -155,11 +157,11 @@ typedef struct { extern calc_t calc; -#define CALC_E 2.7182818284590452354 - -#define CALC_PI_2 1.57079632679489661923 -#define CALC_PI 3.14159265358979323846 -#define CALC_3_PI_2 4.71238898038468985769 +/* IEEE constants */ +#define CALC_E 2.718281828459045235360 +#define CALC_PI_2 1.570796326794896619231 +#define CALC_PI 3.141592653589793238462 +#define CALC_3_PI_2 4.712388980384689857694 #define CALC_2_PI 6.283185307179586476925 #define MODIFIER_INV 0x01 @@ -167,14 +169,9 @@ extern calc_t calc; #define NO_CHAIN 0x04 void apply_int_mask(calc_number_t *a); -#ifdef ENABLE_MULTI_PRECISION -void validate_rad2angle(calc_number_t *c); -void validate_angle2rad(calc_number_t *c); -#else +#ifndef ENABLE_MULTI_PRECISION __int64 logic_dbl2int(calc_number_t *a); double logic_int2dbl(calc_number_t *a); -double validate_rad2angle(double a); -double validate_angle2rad(calc_number_t *c); #endif void rpn_sin(calc_number_t *c); void rpn_cos(calc_number_t *c); @@ -206,7 +203,9 @@ void rpn_exp10(calc_number_t *c); void rpn_ln(calc_number_t *c); void rpn_log(calc_number_t *c); void rpn_ave(calc_number_t *c); +void rpn_ave2(calc_number_t *c); void rpn_sum(calc_number_t *c); +void rpn_sum2(calc_number_t *c); void rpn_s(calc_number_t *c); void rpn_s_m1(calc_number_t *c); void rpn_dms2dec(calc_number_t *c); @@ -217,10 +216,14 @@ int rpn_is_zero(calc_number_t *c); void rpn_alloc(calc_number_t *c); void rpn_free(calc_number_t *c); +// + void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base); void convert_text2number_2(calc_number_t *a); void convert_real_integer(unsigned int base); +// + INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); void ConvExecute(HWND hWnd); diff --git a/base/applications/calc/fun_ieee.c b/base/applications/calc/fun_ieee.c index b5f4ab8824..3e8ba68de8 100644 --- a/base/applications/calc/fun_ieee.c +++ b/base/applications/calc/fun_ieee.c @@ -1,6 +1,27 @@ +/* + * ReactOS Calc (Math functions, IEEE-754 engine) + * + * Copyright 2007-2017, Carlo Bramini + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "calc.h" -#include <limits.h> +static double validate_rad2angle(double a); +static double validate_angle2rad(calc_number_t *c); void apply_int_mask(calc_number_t *r) { @@ -47,7 +68,7 @@ double atanh(double x) return log((1.0+x)/(1.0-x))/2.0; } -double validate_rad2angle(double a) +static double validate_rad2angle(double a) { switch (calc.degr) { case IDC_RADIO_DEG: @@ -62,7 +83,7 @@ double validate_rad2angle(double a) return a; } -double validate_angle2rad(calc_number_t *c) +static double validate_angle2rad(calc_number_t *c) { switch (calc.degr) { case IDC_RADIO_DEG: @@ -250,6 +271,7 @@ __int64 logic_dbl2int(calc_number_t *a) } return (__int64)int_part; } + double logic_int2dbl(calc_number_t *a) { return (double)a->i; @@ -315,9 +337,9 @@ static unsigned __int64 sqrti(unsigned __int64 number) unsigned __int64 n, n1; #ifdef __GNUC__ - if (number == 0xffffffffffffffffLL) + if (number == 0xffffffffffffffffULL) #else - if (number == 0xffffffffffffffff) + if (number == 0xffffffffffffffffUI64) #endif return 0xffffffff; @@ -427,6 +449,21 @@ static double stat_sum(void) return sum; } +static double stat_sum2(void) +{ + double sum = 0; + statistic_t *p = calc.stat; + + while (p != NULL) { + if (p->base == IDC_RADIO_DEC) + sum += p->num.f * p->num.f; + else + sum += (double)p->num.i * (double)p->num.i; + p = (statistic_t *)(p->next); + } + return sum; +} + void rpn_ave(calc_number_t *c) { double ave = 0; @@ -443,6 +480,22 @@ void rpn_ave(calc_number_t *c) c->i = (__int64)ave; } +void rpn_ave2(calc_number_t *c) +{ + double ave = 0; + int n; + + ave = stat_sum2(); + n = SendDlgItemMessage(calc.hStatWnd, IDC_LIST_STAT, LB_GETCOUNT, 0, 0); + + if (n) + ave = ave / (double)n; + if (calc.base == IDC_RADIO_DEC) + c->f = ave; + else + c->i = (__int64)ave; +} + void rpn_sum(calc_number_t *c) { double sum = stat_sum(); @@ -453,6 +506,16 @@ void rpn_sum(calc_number_t *c) c->i = (__int64)sum; } +void rpn_sum2(calc_number_t *c) +{ + double sum = stat_sum2(); + + if (calc.base == IDC_RADIO_DEC) + c->f = sum; + else + c->i = (__int64)sum; +} + static void rpn_s_ex(calc_number_t *c, int pop_type) { double ave = 0; diff --git a/base/applications/calc/fun_mpfr.c b/base/applications/calc/fun_mpfr.c index 8d1534048a..27c7f37b7e 100644 --- a/base/applications/calc/fun_mpfr.c +++ b/base/applications/calc/fun_mpfr.c @@ -1,5 +1,28 @@ +/* + * ReactOS Calc (Math functions, GMP/MPFR engine) + * + * Copyright 2007-2017, Carlo Bramini + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "calc.h" +static void validate_rad2angle(calc_number_t *c); +static void validate_angle2rad(calc_number_t *c); + void apply_int_mask(calc_number_t *r) { mpz_t a, mask; @@ -28,7 +51,7 @@ void apply_int_mask(calc_number_t *r) mpz_clear(mask); } -void validate_rad2angle(calc_number_t *r) +static void validate_rad2angle(calc_number_t *r) { mpfr_t mult, divs; @@ -55,7 +78,7 @@ void validate_rad2angle(calc_number_t *r) mpfr_clear(divs); } -void validate_angle2rad(calc_number_t *r) +static void validate_angle2rad(calc_number_t *r) { mpfr_t mult, divs; @@ -341,6 +364,21 @@ static void stat_sum(mpfr_t sum) } } +static void stat_sum2(mpfr_t sum) +{ + statistic_t *p = calc.stat; + mpfr_t sqr; + + mpfr_init(sqr); + mpfr_set_ui(sum, 0, MPFR_DEFAULT_RND); + while (p != NULL) { + mpfr_mul(sqr, p->num.mf, p->num.mf, MPFR_DEFAULT_RND); + mpfr_add(sum, sum, sqr, MPFR_DEFAULT_RND); + p = (statistic_t *)(p->next); + } + mpfr_clear(sqr); +} + void rpn_ave(calc_number_t *c) { int n; @@ -355,6 +393,20 @@ void rpn_ave(calc_number_t *c) mpfr_trunc(c->mf, c->mf); } +void rpn_ave2(calc_number_t *c) +{ + int n; + + stat_sum2(c->mf); + n = SendDlgItemMessage(calc.hStatWnd, IDC_LIST_STAT, LB_GETCOUNT, 0, 0); + + if (n) + mpfr_div_ui(c->mf, c->mf, n, MPFR_DEFAULT_RND); + + if (calc.base != IDC_RADIO_DEC) + mpfr_trunc(c->mf, c->mf); +} + void rpn_sum(calc_number_t *c) { stat_sum(c->mf); @@ -363,6 +415,14 @@ void rpn_sum(calc_number_t *c) mpfr_trunc(c->mf, c->mf); } +void rpn_sum2(calc_number_t *c) +{ + stat_sum2(c->mf); + + if (calc.base != IDC_RADIO_DEC) + mpfr_trunc(c->mf, c->mf); +} + static void rpn_s_ex(calc_number_t *c, int pop_type) { mpfr_t dev; diff --git a/base/applications/calc/help.txt b/base/applications/calc/help.txt index be9ccd87fd..453ba2641d 100644 --- a/base/applications/calc/help.txt +++ b/base/applications/calc/help.txt @@ -204,10 +204,16 @@ It deletes all numbers currently stored into the list. While the statistical window is shown, four additional buttons are enabled: [Ave] It calculates the arithmetic average of the numbers stored into the list. +[Ave] + [Inv] +It calculates the arithmetic average of the squares of the numbers stored into the list. [Sum] It calculates the sum of all numbers stored into the list. +[Sum] + [Inv] +It calculates the sum of the squares of all numbers stored into the list. [s] -It calculates the population standard deviations of the numbers stored into the list. +It calculates the population standard deviations with base 'n-1' of the numbers stored into the list. +[s] + [Inv] +It calculates the population standard deviations with base 'n' of the numbers stored into the list. [Dat] It inserts the number shown into the output display into the list. @@ -483,10 +489,12 @@ Shortcut from keyboard: CTRL-S Ave It calculates the arithmetic average of the numbers stored into the statistical box. +When used with [Inv] modifier it calculates the average of squares. Shortcut from keyboard: CTRL-A Sum It calculates the sum of the numbers stored into the statistical box. +When used with [Inv] modifier it calculates the summation of squares. Shortcut from keyboard: CTRL-T s diff --git a/base/applications/calc/resource.h b/base/applications/calc/resource.h index 82184624c5..c9a3ac0e21 100644 --- a/base/applications/calc/resource.h +++ b/base/applications/calc/resource.h @@ -101,6 +101,7 @@ #define IDC_COMBO_FROM 1091 #define IDC_COMBO_TO 1092 #define IDC_BUTTON_RSH 1093 +#define IDC_BUTTON_XrY 1094 /* TYPES OF CONVERSIONS */ #define IDS_CONV_ANGLE 2000 diff --git a/base/applications/calc/rpn_ieee.c b/base/applications/calc/rpn_ieee.c index a6f4e417b0..0649789a4f 100644 --- a/base/applications/calc/rpn_ieee.c +++ b/base/applications/calc/rpn_ieee.c @@ -1,3 +1,23 @@ +/* + * ReactOS Calc (RPN encoder/decoder for IEEE-754 engine) + * + * Copyright 2007-2017, Carlo Bramini + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "calc.h" typedef struct { @@ -15,7 +35,7 @@ typedef struct { } calc_operator_t; static stack_node_t *stack; -static stack_node_t temp; +static calc_node_t temp; static BOOL percent_mode; static void rpn_add_f(calc_number_t *r, calc_number_t *a, calc_number_t *b); @@ -67,14 +87,20 @@ static const calc_operator_t operator_list[] = { { 7, rpn_sqr_f, NULL, NULL, }, // RPN_OPERATOR_SQR }; -static stack_node_t *pop(void) +static calc_node_t *pop(void) { + void *next; + if (stack == NULL) return NULL; - temp = *stack; + /* copy the node */ + temp = stack->node; + next = stack->next; + + /* free the node */ free(stack); - stack = temp.next; + stack = next; return &temp; } @@ -84,11 +110,11 @@ static int is_stack_empty(void) return (stack == NULL); } -static void push(stack_node_t *op) +static void push(calc_node_t *op) { stack_node_t *z = (stack_node_t *)malloc(sizeof(stack_node_t)); - *z = *op; + z->node = *op; z->next = stack; stack = z; } @@ -330,20 +356,20 @@ void run_operator(calc_node_t *result, static void evalStack(calc_number_t *number) { - stack_node_t *op, ip; + calc_node_t *op, ip; unsigned int prec; op = pop(); ip = *op; - prec = operator_list[ip.node.operation].prec; + prec = operator_list[ip.operation].prec; while (!is_stack_empty()) { op = pop(); - if (prec <= operator_list[op->node.operation].prec) { - if (op->node.operation == RPN_OPERATOR_PARENT) continue; + if (prec <= operator_list[op->operation].prec) { + if (op->operation == RPN_OPERATOR_PARENT) continue; - calc.prev = ip.node.number; - run_operator(&ip.node, &op->node, &ip.node, op->node.operation); + calc.prev = ip.number; + run_operator(&ip, op, &ip, op->operation); if (calc.is_nan) { flush_postfix(); return; @@ -354,17 +380,17 @@ static void evalStack(calc_number_t *number) } } - if(ip.node.operation != RPN_OPERATOR_EQUAL && ip.node.operation != RPN_OPERATOR_PERCENT) + if (ip.operation != RPN_OPERATOR_EQUAL && ip.operation != RPN_OPERATOR_PERCENT) push(&ip); - calc.prev_operator = op->node.operation; + calc.prev_operator = op->operation; - *number = ip.node.number; + *number = ip.number; } int exec_infix2postfix(calc_number_t *number, unsigned int func) { - stack_node_t tmp; + calc_node_t tmp; if (is_stack_empty() && func == RPN_OPERATOR_EQUAL) { /* if a number has been entered with exponential */ @@ -377,10 +403,9 @@ int exec_infix2postfix(calc_number_t *number, unsigned int func) if (func == RPN_OPERATOR_PERCENT) percent_mode = TRUE; - tmp.node.number = *number; - tmp.node.base = calc.base; - tmp.node.operation = func; - tmp.next = NULL; + tmp.number = *number; + tmp.base = calc.base; + tmp.operation = func; push(&tmp); @@ -410,23 +435,23 @@ void exec_change_infix(void) void exec_closeparent(calc_number_t *number) { - stack_node_t *op, ip; + calc_node_t *op, ip; - ip.node.number = *number; - ip.node.base = calc.base; + ip.number = *number; + ip.base = calc.base; while (!is_stack_empty()) { op = pop(); - if (op->node.operation == RPN_OPERATOR_PARENT) + if (op->operation == RPN_OPERATOR_PARENT) break; - run_operator(&ip.node, &op->node, &ip.node, op->node.operation); + run_operator(&ip, op, &ip, op->operation); if (calc.is_nan) { flush_postfix(); return; } } - *number = ip.node.number; + *number = ip.number; } int eval_parent_count(void) @@ -442,7 +467,7 @@ int eval_parent_count(void) return n; } -void flush_postfix() +void flush_postfix(void) { while (!is_stack_empty()) pop(); @@ -459,4 +484,3 @@ void start_rpn_engine(void) void stop_rpn_engine(void) { } - diff --git a/base/applications/calc/rpn_mpfr.c b/base/applications/calc/rpn_mpfr.c index 93d6f00f20..d555bc2108 100644 --- a/base/applications/calc/rpn_mpfr.c +++ b/base/applications/calc/rpn_mpfr.c @@ -1,3 +1,23 @@ +/* + * ReactOS Calc (RPN encoder/decoder for GMP/MPFR engine) + * + * Copyright 2007-2017, Carlo Bramini + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "calc.h" typedef struct { @@ -15,7 +35,7 @@ typedef struct { } calc_operator_t; static stack_node_t *stack; -static stack_node_t temp; +static calc_node_t temp; static BOOL percent_mode; static void rpn_add_f(calc_number_t *r, calc_number_t *a, calc_number_t *b); @@ -61,25 +81,27 @@ static const calc_operator_t operator_list[] = { { 7, rpn_sqr_f, NULL, NULL, }, // RPN_OPERATOR_SQR }; -static void node_copy(stack_node_t *dst, stack_node_t *src) +static void node_copy(calc_node_t *dst, calc_node_t *src) { - mpfr_set(dst->node.number.mf,src->node.number.mf,MPFR_DEFAULT_RND); - dst->node.operation = src->node.operation; - dst->next = src->next; + mpfr_set(dst->number.mf, src->number.mf, MPFR_DEFAULT_RND); + dst->operation = src->operation; } -static stack_node_t *pop() +static calc_node_t *pop(void) { + void *next; + if (stack == NULL) return NULL; /* copy the node */ - node_copy(&temp, stack); + node_copy(&temp, &stack->node); + next = stack->next; /* free the node */ mpfr_clear(stack->node.number.mf); free(stack); - stack = temp.next; + stack = next; return &temp; } @@ -89,12 +111,12 @@ static int is_stack_empty(void) return (stack == NULL); } -static void push(stack_node_t *op) +static void push(calc_node_t *op) { stack_node_t *z = (stack_node_t *)malloc(sizeof(stack_node_t)); - mpfr_init_set(z->node.number.mf,op->node.number.mf,MPFR_DEFAULT_RND); - z->node.operation = op->node.operation; + mpfr_init_set(z->node.number.mf, op->number.mf, MPFR_DEFAULT_RND); + z->node.operation = op->operation; z->next = stack; stack = z; } @@ -109,8 +131,7 @@ static unsigned int get_prec(unsigned int opc) } */ -typedef -__GMP_DECLSPEC void (*exec_call_t) +typedef void (*exec_call_t) __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); static void rpn_exec_int(calc_number_t *r, calc_number_t *a, calc_number_t *b, exec_call_t cb) @@ -286,7 +307,6 @@ static void rpn_div_p(calc_number_t *r, calc_number_t *a, calc_number_t *b) } } - void run_operator(calc_node_t *result, calc_node_t *a, calc_node_t *b, @@ -307,44 +327,44 @@ void run_operator(calc_node_t *result, static void evalStack(calc_number_t *number) { - stack_node_t *op, ip; + calc_node_t *op, ip; unsigned int prec; - mpfr_init(ip.node.number.mf); + mpfr_init(ip.number.mf); op = pop(); node_copy(&ip, op); - prec = operator_list[ip.node.operation].prec; + prec = operator_list[ip.operation].prec; while (!is_stack_empty()) { op = pop(); - if (prec <= operator_list[op->node.operation].prec) { - if (op->node.operation == RPN_OPERATOR_PARENT) continue; + if (prec <= operator_list[op->operation].prec) { + if (op->operation == RPN_OPERATOR_PARENT) continue; - rpn_copy(&calc.prev, &ip.node.number); - run_operator(&ip.node, &op->node, &ip.node, op->node.operation); + rpn_copy(&calc.prev, &ip.number); + run_operator(&ip, op, &ip, op->operation); if (calc.is_nan) { flush_postfix(); - mpfr_clear(ip.node.number.mf); + mpfr_clear(ip.number.mf); return; } } else { push(op); break; - } + } } - if(ip.node.operation != RPN_OPERATOR_EQUAL && ip.node.operation != RPN_OPERATOR_PERCENT) + if (ip.operation != RPN_OPERATOR_EQUAL && ip.operation != RPN_OPERATOR_PERCENT) push(&ip); - calc.prev_operator = op->node.operation; + calc.prev_operator = op->operation; - rpn_copy(number, &ip.node.number); - mpfr_clear(ip.node.number.mf); + rpn_copy(number, &ip.number); + mpfr_clear(ip.number.mf); } int exec_infix2postfix(calc_number_t *number, unsigned int func) { - stack_node_t tmp; + calc_node_t tmp; if (is_stack_empty() && func == RPN_OPERATOR_EQUAL) { /* if a number has been entered with exponential */ @@ -357,12 +377,12 @@ int exec_infix2postfix(calc_number_t *number, unsigned int func) if (func == RPN_OPERATOR_PERCENT) percent_mode = TRUE; - mpfr_init(tmp.node.number.mf); - rpn_copy(&tmp.node.number, number); - tmp.node.operation = func; + mpfr_init(tmp.number.mf); + rpn_copy(&tmp.number, number); + tmp.operation = func; push(&tmp); - mpfr_clear(tmp.node.number.mf); + mpfr_clear(tmp.number.mf); if (func == RPN_OPERATOR_NONE) return 0; @@ -390,24 +410,24 @@ void exec_change_infix(void) void exec_closeparent(calc_number_t *number) { - stack_node_t *op, ip; + calc_node_t *op, ip; - rpn_alloc(&ip.node.number); - rpn_copy(&ip.node.number, number); + rpn_alloc(&ip.number); + rpn_copy(&ip.number, number); while (!is_stack_empty()) { op = pop(); - if (op->node.operation == RPN_OPERATOR_PARENT) + if (op->operation == RPN_OPERATOR_PARENT) break; - run_operator(&ip.node, &op->node, &ip.node, op->node.operation); + run_operator(&ip, op, &ip, op->operation); if (calc.is_nan) { flush_postfix(); return; } } - rpn_copy(number, &ip.node.number); - rpn_free(&ip.node.number); + rpn_copy(number, &ip.number); + rpn_free(&ip.number); } int eval_parent_count(void) @@ -423,12 +443,12 @@ int eval_parent_count(void) return n; } -void flush_postfix() +void flush_postfix(void) { while (!is_stack_empty()) pop(); /* clear prev and last typed operators */ - calc.prev_operator = + calc.prev_operator = calc.last_operator = 0; } @@ -440,7 +460,7 @@ void start_rpn_engine(void) mpfr_init(calc.code.mf); mpfr_init(calc.prev.mf); mpfr_init(calc.memory.number.mf); - mpfr_init(temp.node.number.mf); + mpfr_init(temp.number.mf); rpn_zero(&calc.memory.number); } @@ -449,5 +469,5 @@ void stop_rpn_engine(void) mpfr_clear(calc.code.mf); mpfr_clear(calc.prev.mf); mpfr_clear(calc.memory.number.mf); - mpfr_clear(temp.node.number.mf); + mpfr_clear(temp.number.mf); } diff --git a/base/applications/calc/utl_ieee.c b/base/applications/calc/utl_ieee.c index c240bf2855..69be266f61 100644 --- a/base/applications/calc/utl_ieee.c +++ b/base/applications/calc/utl_ieee.c @@ -1,3 +1,23 @@ +/* + * ReactOS Calc (Utility functions for IEEE-754 engine) + * + * Copyright 2007-2017, Carlo Bramini + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "calc.h" void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base) @@ -7,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, TEXT("%I64X"), rpn->i); + _stprintf(buffer, _T("%I64X"), rpn->i); break; case IDC_RADIO_DEC: /* @@ -19,44 +39,44 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base) #define MAX_LD_WIDTH 16 /* calculate the width of integer number */ width = (rpn->f==0) ? 1 : (int)log10(fabs(rpn->f))+1; - if ((calc.sci_out != FALSE) || (width > MAX_LD_WIDTH) || (width < -MAX_LD_WIDTH)) - _stprintf(buffer, TEXT("%#e"), rpn->f); + if (calc.sci_out == TRUE || width > MAX_LD_WIDTH || width < -MAX_LD_WIDTH) + _stprintf(buffer, _T("%#.*e"), MAX_LD_WIDTH-1, rpn->f); else { TCHAR *ptr, *dst; - ptr = buffer + _stprintf(buffer, TEXT("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f); + ptr = buffer + _stprintf(buffer, _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, TEXT('.')); + dst = _tcschr(buffer, _T('.')); while (--ptr > dst) - if (*ptr != TEXT('0')) + if (*ptr != _T('0')) break; /* put the string terminator for removing the final '0' (if any) */ - ptr[1] = TEXT('\0'); + ptr[1] = _T('\0'); /* check if the number finishes with '.' */ if (ptr == dst) /* remove the dot (it will be re-added later) */ - ptr[0] = TEXT('\0'); + ptr[0] = _T('\0'); } #undef MAX_LD_WIDTH break; case IDC_RADIO_OCT: - _stprintf(buffer, TEXT("%I64o"), rpn->i); + _stprintf(buffer, _T("%I64o"), rpn->i); break; case IDC_RADIO_BIN: if (rpn->i == 0) { - buffer[0] = TEXT('0'); - buffer[1] = TEXT('\0'); + buffer[0] = _T('0'); + buffer[1] = _T('\0'); break; } tmp = *rpn; - buffer[0] = TEXT('\0'); + buffer[0] = _T('\0'); while (tmp.u) { memmove(buffer+1, buffer, (size-1)*sizeof(TCHAR)); if (tmp.u & 1) - calc.buffer[0] = TEXT('1'); + buffer[0] = _T('1'); else - calc.buffer[0] = TEXT('0'); + buffer[0] = _T('0'); tmp.u >>= 1; } break; @@ -69,20 +89,20 @@ void convert_text2number_2(calc_number_t *a) switch (calc.base) { case IDC_RADIO_HEX: - _stscanf(calc.buffer, TEXT("%I64X"), &(a->i)); + _stscanf(calc.buffer, _T("%I64X"), &(a->i)); break; case IDC_RADIO_DEC: - _stscanf(calc.buffer, TEXT("%lf"), &(a->f)); + _stscanf(calc.buffer, _T("%lf"), &(a->f)); break; case IDC_RADIO_OCT: - _stscanf(calc.buffer, TEXT("%I64o"), &(a->i)); + _stscanf(calc.buffer, _T("%I64o"), &(a->i)); break; case IDC_RADIO_BIN: ptr = calc.buffer; a->i = 0; - while (*ptr != TEXT('\0')) { + while (*ptr != _T('\0')) { a->i <<= 1; - if (*ptr++ == TEXT('1')) + if (*ptr++ == _T('1')) a->i |= 1; } break; diff --git a/base/applications/calc/utl_mpfr.c b/base/applications/calc/utl_mpfr.c index 048b3b92c6..5c2d797e80 100644 --- a/base/applications/calc/utl_mpfr.c +++ b/base/applications/calc/utl_mpfr.c @@ -1,3 +1,23 @@ +/* + * ReactOS Calc (Utility functions for GMP/MPFR engine) + * + * Copyright 2007-2017, Carlo Bramini + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "calc.h" void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base) @@ -39,7 +59,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base) width = 1 + mpfr_get_si(t, MPFR_DEFAULT_RND); mpfr_clear(t); } - if ((calc.sci_out != FALSE) || (width > max_ld_width) || (width < -max_ld_width)) + if (calc.sci_out == TRUE || width > max_ld_width || width < -max_ld_width) ptr = temp + gmp_sprintf(temp, "%*.*#Fe", 1, max_ld_width, ff); else { ptr = temp + gmp_sprintf(temp, "%#*.*Ff", width, ((max_ld_width-width-1)>=0) ? max_ld_width-width-1 : 0, ff); @@ -62,8 +82,8 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base) case IDC_RADIO_BIN: /* if the number is zero, just write 0 ;) */ if (rpn_is_zero(rpn)) { - temp[0] = TEXT('0'); - temp[1] = TEXT('\0'); + temp[0] = _T('0'); + temp[1] = _T('\0'); break; } /* repeat until a bit set to '1' is found */ @@ -78,8 +98,8 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base) } while (1); /* now revert the string into TCHAR buffer */ for (q=0; q<n; q++) - buffer[n-q-1] = (temp[q] == '1') ? TEXT('1') : TEXT('0'); - buffer[n] = TEXT('\0'); + buffer[n-q-1] = (temp[q] == '1') ? _T('1') : _T('0'); + buffer[n] = _T('\0'); mpz_clear(zz); mpf_clear(ff); @@ -87,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), TEXT("%s"), temp); + _sntprintf(buffer, SIZEOF(calc.buffer), _T("%hs"), temp); } void convert_text2number_2(calc_number_t *a) @@ -135,4 +155,3 @@ void convert_real_integer(unsigned int base) break; } } - diff --git a/base/applications/calc/winmain.c b/base/applications/calc/winmain.c index e976131996..c6723bac18 100644 --- a/base/applications/calc/winmain.c +++ b/base/applications/calc/winmain.c @@ -166,6 +166,8 @@ static const WORD operator_codes[] = { IDC_BUTTON_MULT, // RPN_OPERATOR_MULT IDC_BUTTON_DIV, // RPN_OPERATOR_DIV IDC_BUTTON_MOD, // RPN_OPERATOR_MOD + IDC_BUTTON_XeY, // RPN_OPERATOR_POW + IDC_BUTTON_XrY, // RPN_OPERATOR_SQR }; typedef void (*rpn_callback1)(calc_number_t *); @@ -180,8 +182,6 @@ typedef struct { rpn_callback1 inv_hyp; } function_table_t; -static void run_pow(calc_number_t *number); -static void run_sqr(calc_number_t *number); static void run_fe(calc_number_t *number); static void run_dat_sta(calc_number_t *number); static void run_mp(calc_number_t *c); @@ -205,10 +205,9 @@ static const function_table_t function_table[] = { { IDC_BUTTON_LN, MODIFIER_INV, 1, rpn_ln, rpn_exp, NULL, NULL }, { IDC_BUTTON_LOG, MODIFIER_INV, 1, rpn_log, rpn_exp10, NULL, NULL }, { IDC_BUTTON_NF, 0, 1, rpn_fact, NULL, NULL, NULL }, - { IDC_BUTTON_AVE, 0, 0, rpn_ave, NULL, NULL, NULL }, - { IDC_BUTTON_SUM, 0, 0, rpn_sum, NULL, NULL, NULL }, + { IDC_BUTTON_AVE, MODIFIER_INV, 0, rpn_ave, rpn_ave2, NULL, NULL }, + { IDC_BUTTON_SUM, MODIFIER_INV, 0, rpn_sum, rpn_sum2, NULL, NULL }, { IDC_BUTTON_S, MODIFIER_INV, 0, rpn_s_m1, rpn_s, NULL, NULL }, - { IDC_BUTTON_XeY, MODIFIER_INV, 1, run_pow, run_sqr, NULL, NULL }, { IDC_BUTTON_SQRT, MODIFIER_INV, 1, rpn_sqrt, NULL, NULL, NULL }, { IDC_BUTTON_DMS, MODIFIER_INV, 1, rpn_dec2dms, rpn_dms2dec, NULL, NULL }, { IDC_BUTTON_FE, 0, 1, run_fe, NULL, NULL, NULL }, @@ -1132,16 +1131,6 @@ static statistic_t *upload_stat_number(int n) return p; } -static void run_pow(calc_number_t *number) -{ - exec_infix2postfix(number, RPN_OPERATOR_POW); -} - -static void run_sqr(calc_number_t *number) -{ - exec_infix2postfix(number, RPN_OPERATOR_SQR); -} - static void run_fe(calc_number_t *number) { calc.sci_out = ((calc.sci_out != FALSE) ? FALSE : TRUE); @@ -1531,17 +1520,29 @@ static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) case IDC_BUTTON_LSH: case IDC_BUTTON_RSH: case IDC_BUTTON_EQU: + case IDC_BUTTON_XeY: + case IDC_BUTTON_XrY: if (calc.is_nan) break; /* - * LSH button holds the RSH function too with INV modifier, - * but since it's a two operand operator, it must be handled here. + * LSH and XeY buttons hold also the RSH and XrY functions with INV modifier, + * but since they are two operand operators, they must be handled here. */ - if (LOWORD(wp) == IDC_BUTTON_LSH && - (get_modifiers(hWnd) & MODIFIER_INV)) { - PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_BUTTON_RSH, BN_CLICKED), 0); - SendDlgItemMessage(hWnd, IDC_CHECK_INV, BM_SETCHECK, 0, 0); - break; + if ((get_modifiers(hWnd) & MODIFIER_INV)) + { + WPARAM IdcSim = IDC_STATIC; + + switch (LOWORD(wp)) { + case IDC_BUTTON_LSH: IdcSim = MAKEWPARAM(IDC_BUTTON_RSH, BN_CLICKED); break; + case IDC_BUTTON_XeY: IdcSim = MAKEWPARAM(IDC_BUTTON_XrY, BN_CLICKED); break; + } + + if (IdcSim != IDC_STATIC) + { + PostMessage(hWnd, WM_COMMAND, IdcSim, 0); + CheckDlgButton(hWnd, IDC_CHECK_INV, BST_UNCHECKED); + } } + for (x=0; x<SIZEOF(operator_codes); x++) { if (LOWORD(wp) == operator_codes[x]) { convert_text2number(&calc.code); @@ -1668,7 +1669,6 @@ static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) case IDC_BUTTON_SIN: case IDC_BUTTON_COS: case IDC_BUTTON_TAN: - case IDC_BUTTON_XeY: case IDC_BUTTON_MS: for (x=0; x<SIZEOF(function_table); x++) { if (LOWORD(wp) == function_table[x].idc) { @@ -1697,8 +1697,8 @@ static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) convert_text2number(&calc.code); cb(&calc.code); display_rpn_result(hWnd, &calc.code); - if (!(function_table[x].range & NO_CHAIN)) - exec_infix2postfix(&calc.code, RPN_OPERATOR_NONE); +// if (!(function_table[x].range & NO_CHAIN)) +// exec_infix2postfix(&calc.code, RPN_OPERATOR_NONE); if (function_table[x].range & MODIFIER_INV) SendDlgItemMessage(hWnd, IDC_CHECK_INV, BM_SETCHECK, 0, 0); if (function_table[x].range & MODIFIER_HYP)
5 years, 9 months
1
0
0
0
[reactos] 01/13: [CALC] Rename files only.
by Carlo-Bramini
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=28f493624ab1d9da1935d…
commit 28f493624ab1d9da1935df851228d7a4a6395488 Author: Carlo-Bramini <carlo_bramini(a)users.sourceforge.net> AuthorDate: Mon Aug 6 09:52:59 2018 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Mon Mar 18 01:33:51 2019 +0100 [CALC] Rename files only. --- base/applications/calc/CMakeLists.txt | 6 +++--- base/applications/calc/{function.c => fun_ieee.c} | 0 base/applications/calc/{rpn.c => rpn_ieee.c} | 0 base/applications/calc/{utl.c => utl_ieee.c} | 0 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/applications/calc/CMakeLists.txt b/base/applications/calc/CMakeLists.txt index 2d0d6055d8..a92c7c3911 100644 --- a/base/applications/calc/CMakeLists.txt +++ b/base/applications/calc/CMakeLists.txt @@ -3,9 +3,9 @@ add_definitions(-DDISABLE_HTMLHELP_SUPPORT=1) list(APPEND SOURCE convert.c - function.c - rpn.c - utl.c + fun_ieee.c + rpn_ieee.c + utl_ieee.c winmain.c calc.h) diff --git a/base/applications/calc/function.c b/base/applications/calc/fun_ieee.c similarity index 100% rename from base/applications/calc/function.c rename to base/applications/calc/fun_ieee.c diff --git a/base/applications/calc/rpn.c b/base/applications/calc/rpn_ieee.c similarity index 100% rename from base/applications/calc/rpn.c rename to base/applications/calc/rpn_ieee.c diff --git a/base/applications/calc/utl.c b/base/applications/calc/utl_ieee.c similarity index 100% rename from base/applications/calc/utl.c rename to base/applications/calc/utl_ieee.c
5 years, 9 months
1
0
0
0
[reactos] 01/01: [USERENV] Implement GetProfileType().
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c8d44606d61e3bbace306…
commit c8d44606d61e3bbace3068a989249383fba3209d Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 17 17:51:32 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 17 17:51:32 2019 +0100 [USERENV] Implement GetProfileType(). --- dll/win32/userenv/profile.c | 95 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c index cf5424288a..6a079076bf 100644 --- a/dll/win32/userenv/profile.c +++ b/dll/win32/userenv/profile.c @@ -1566,8 +1566,99 @@ WINAPI GetProfileType( _Out_ PDWORD pdwFlags) { - DPRINT1("GetProfileType() not implemented!\n"); - return FALSE; + UNICODE_STRING SidString = {0, 0, NULL}; + HANDLE hToken; + HKEY hProfilesKey = NULL, hProfileKey = NULL; + DWORD dwType, dwLength, dwState = 0; + DWORD dwError; + BOOL bResult = FALSE; + + DPRINT("GetProfileType(%p)\n", pdwFlags); + + if (pdwFlags == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken)) + { + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) + { + DPRINT1("Failed to open a token (Error %lu)\n", GetLastError()); + return FALSE; + } + } + + /* Get the user SID string */ + if (!GetUserSidStringFromToken(hToken, &SidString)) + { + DPRINT1("GetUserSidStringFromToken() failed\n"); + goto done; + } + + DPRINT("SID: %wZ\n", &SidString); + + dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", + 0, + KEY_QUERY_VALUE, + &hProfilesKey); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + SetLastError(dwError); + goto done; + } + + dwError = RegOpenKeyExW(hProfilesKey, + SidString.Buffer, + 0, + KEY_QUERY_VALUE | KEY_SET_VALUE, + &hProfileKey); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + SetLastError(dwError); + goto done; + } + + /* Get the State value */ + dwLength = sizeof(dwState); + dwError = RegQueryValueExW(hProfileKey, + L"State", + NULL, + &dwType, + (PBYTE)&dwState, + &dwLength); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + SetLastError(dwError); + goto done; + } + + *pdwFlags = 0; + + if (dwState & 0x80) /* PROFILE_GUEST_USER */ + *pdwFlags |= PT_TEMPORARY; + + /* FIXME: Add checks for PT_MANDATORY and PT_ROAMING */ + + bResult = TRUE; + +done: + if (hProfileKey != NULL) + RegCloseKey(hProfileKey); + + if (hProfilesKey != NULL) + RegCloseKey(hProfilesKey); + + RtlFreeUnicodeString(&SidString); + + CloseHandle(hToken); + + return bResult; }
5 years, 9 months
1
0
0
0
[reactos] 01/01: [USERENV] LoadUserProfileW: Check the user for Administators and Guests group membership and set the State value accordingly.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f21a8a6e699d83168dbc…
commit 0f21a8a6e699d83168dbcbe8438a53423773247f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 17 12:44:54 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 17 12:44:54 2019 +0100 [USERENV] LoadUserProfileW: Check the user for Administators and Guests group membership and set the State value accordingly. See
https://www.pcreview.co.uk/threads/purpose-of-the-state-key-located-in-user…
--- dll/win32/userenv/internal.h | 4 ++ dll/win32/userenv/misc.c | 4 +- dll/win32/userenv/profile.c | 115 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 117 insertions(+), 6 deletions(-) diff --git a/dll/win32/userenv/internal.h b/dll/win32/userenv/internal.h index f33725ffd7..2c1cfeb79b 100644 --- a/dll/win32/userenv/internal.h +++ b/dll/win32/userenv/internal.h @@ -40,6 +40,10 @@ BOOL RemoveDirectoryPath(LPCWSTR lpPathName); /* misc.c */ + +extern SID_IDENTIFIER_AUTHORITY LocalSystemAuthority; +extern SID_IDENTIFIER_AUTHORITY WorldAuthority; + typedef struct _DYN_FUNCS { HMODULE hModule; diff --git a/dll/win32/userenv/misc.c b/dll/win32/userenv/misc.c index 9014998e40..214d8f1f44 100644 --- a/dll/win32/userenv/misc.c +++ b/dll/win32/userenv/misc.c @@ -31,8 +31,8 @@ #define NDEBUG #include <debug.h> -static SID_IDENTIFIER_AUTHORITY LocalSystemAuthority = {SECURITY_NT_AUTHORITY}; -static SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; +SID_IDENTIFIER_AUTHORITY LocalSystemAuthority = {SECURITY_NT_AUTHORITY}; +SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; /* FUNCTIONS ***************************************************************/ diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c index bd859cc21c..cf5424288a 100644 --- a/dll/win32/userenv/profile.c +++ b/dll/win32/userenv/profile.c @@ -348,6 +348,106 @@ done: } +static +DWORD +CheckForGuestsAndAdmins( + _In_ HANDLE hToken, + _Out_ PDWORD pdwState) +{ + PTOKEN_GROUPS pGroupInfo = NULL; + PSID pAdministratorsSID = NULL; + PSID pGuestsSID = NULL; + DWORD i, dwSize; + DWORD dwError = ERROR_SUCCESS; + + DPRINT("CheckForGuestsAndAdmins(%p %p)\n", hToken, pdwState); + + /* Get the buffer size */ + if (!GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize)) + { + dwError = GetLastError(); + if (dwError != ERROR_INSUFFICIENT_BUFFER) + { + DPRINT1("GetTokenInformation() failed (Error %lu)\n", dwError); + return dwError; + } + + dwError = ERROR_SUCCESS; + } + + /* Allocate the buffer */ + pGroupInfo = (PTOKEN_GROUPS)HeapAlloc(GetProcessHeap(), 0, dwSize); + if (pGroupInfo == NULL) + { + dwError = ERROR_OUTOFMEMORY; + DPRINT1("HeapAlloc() failed (Error %lu)\n", dwError); + goto done; + } + + /* Get the token groups */ + if (!GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize)) + { + dwError = GetLastError(); + DPRINT1("GetTokenInformation() failed (Error %lu)\n", dwError); + goto done; + } + + /* Build the Administrators Group SID */ + if(!AllocateAndInitializeSid(&LocalSystemAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &pAdministratorsSID)) + { + dwError = GetLastError(); + DPRINT1("AllocateAndInitializeSid() failed (Error %lu)\n", dwError); + goto done; + } + + /* Build the Guests Group SID */ + if(!AllocateAndInitializeSid(&LocalSystemAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_GUESTS, + 0, 0, 0, 0, 0, 0, + &pGuestsSID)) + { + dwError = GetLastError(); + DPRINT1("AllocateAndInitializeSid() failed (Error %lu)\n", dwError); + goto done; + } + + /* Check for Administratos or Guests group memberships */ + for (i = 0; i < pGroupInfo->GroupCount; i++) + { + if (EqualSid(pAdministratorsSID, pGroupInfo->Groups[i].Sid)) + { + *pdwState |= 0x0100; // PROFILE_ADMIN_USER + } + + if (EqualSid(pGuestsSID, pGroupInfo->Groups[i].Sid)) + { + *pdwState |= 0x0080; // PROFILE_GUESTS_USER + } + } + + dwError = ERROR_SUCCESS; + +done: + if (pGuestsSID != NULL) + FreeSid(pGuestsSID); + + if (pAdministratorsSID != NULL) + FreeSid(pAdministratorsSID); + + if (pGroupInfo != NULL) + HeapFree(GetProcessHeap(), 0, pGroupInfo); + + return dwError; +} + + static DWORD SetProfileData( @@ -360,8 +460,7 @@ SetProfileData( DWORD dwLength, dwState = 0; DWORD dwError; - DPRINT("SetProfileData(%S %p)\n", - pszSidString, hToken); + DPRINT("SetProfileData(%S %p)\n", pszSidString, hToken); dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", @@ -427,6 +526,14 @@ SetProfileData( goto done; } + dwError = CheckForGuestsAndAdmins(hToken, + &dwState); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + dwLength = sizeof(dwState); dwError = RegSetValueExW(hProfileKey, L"State", @@ -1350,7 +1457,7 @@ GetProfilesDirectoryA( LPWSTR lpBuffer; BOOL bResult; - if (!lpcchSize) + if (!lpcchSize || !lpProfileDir) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -1474,7 +1581,7 @@ GetUserProfileDirectoryA( LPWSTR lpBuffer; BOOL bResult; - if (!lpcchSize) + if (!lpcchSize || !lpProfileDir) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE;
5 years, 9 months
1
0
0
0
[reactos] 01/01: [NETAPI32] NetUserEnum, NetUserGetInfo: Get the user privileges and auth flags for info levels 1, 2, 3, 4 and 11.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=646ab9286c35cabb5da85…
commit 646ab9286c35cabb5da854a775ac227f103a2c6b Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 17 12:34:49 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 17 12:34:49 2019 +0100 [NETAPI32] NetUserEnum, NetUserGetInfo: Get the user privileges and auth flags for info levels 1, 2, 3, 4 and 11. --- dll/win32/netapi32/user.c | 268 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 244 insertions(+), 24 deletions(-) diff --git a/dll/win32/netapi32/user.c b/dll/win32/netapi32/user.c index 1d2b8e299e..a867b786ec 100644 --- a/dll/win32/netapi32/user.c +++ b/dll/win32/netapi32/user.c @@ -39,6 +39,7 @@ typedef struct _ENUM_CONTEXT SAM_HANDLE ServerHandle; SAM_HANDLE BuiltinDomainHandle; SAM_HANDLE AccountDomainHandle; + PSID BuiltinDomainSid; PSID AccountDomainSid; SAM_ENUMERATE_HANDLE EnumerationContext; @@ -400,16 +401,159 @@ FreeUserInfo(PUSER_ALL_INFORMATION UserInfo) static NET_API_STATUS -BuildUserInfoBuffer(SAM_HANDLE UserHandle, - PSID AccountDomainSid, - DWORD level, - ULONG RelativeId, - LPVOID *Buffer) +GetUserPrivileges( + _In_ SAM_HANDLE BuiltinDomainHandle, + _In_ SAM_HANDLE UserHandle, + _In_ PSID AccountDomainSid, + _In_ ULONG RelativeId, + _Out_ PDWORD Priv, + _Out_ PDWORD AuthFlags) +{ + PGROUP_MEMBERSHIP GroupMembership = NULL; + ULONG GroupCount, SidCount, AliasCount, i; + PSID *SidArray = NULL; + PULONG AliasArray = NULL; + BOOL bAdmin = FALSE, bUser = FALSE; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status; + + FIXME("GetUserPrivileges(%p)\n", UserHandle); + + /* Get the users group memberships */ + Status = SamGetGroupsForUser(UserHandle, + &GroupMembership, + &GroupCount); + if (!NT_SUCCESS(Status)) + { + ERR("SamGetGroupsForUser() failed (Status 0x%08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Allocate the SID array */ + ApiStatus = NetApiBufferAllocate((GroupCount + 1) * sizeof(PSID), + (PVOID*)&SidArray); + if (ApiStatus != NERR_Success) + { + goto done; + } + + /* Add the user to the SID array */ + SidCount = 0; + ApiStatus = BuildSidFromSidAndRid(AccountDomainSid, + RelativeId, + &SidArray[0]); + if (ApiStatus != NERR_Success) + { + goto done; + } + + SidCount++; + + /* Add the groups to the SID array */ + for (i = 0; i < GroupCount; i++) + { + ApiStatus = BuildSidFromSidAndRid(AccountDomainSid, + GroupMembership[i].RelativeId, + &SidArray[i + 1]); + if (ApiStatus != NERR_Success) + { + goto done; + } + + SidCount++; + } + + /* Get aliases for the user and his groups */ + Status = SamGetAliasMembership(BuiltinDomainHandle, + SidCount, + SidArray, + &AliasCount, + &AliasArray); + if (!NT_SUCCESS(Status)) + { + ERR("SamGetAliasMembership() failed (Status 0x%08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + *AuthFlags = 0; + + /* Set the AuthFlags */ + for (i = 0; i < AliasCount; i++) + { + switch (AliasArray[i]) + { + case DOMAIN_ALIAS_RID_ADMINS: + bAdmin = TRUE; + break; + + case DOMAIN_ALIAS_RID_USERS: + bUser = TRUE; + break; + + case DOMAIN_ALIAS_RID_ACCOUNT_OPS: + *AuthFlags |= AF_OP_ACCOUNTS; + break; + + case DOMAIN_ALIAS_RID_SYSTEM_OPS: + *AuthFlags |= AF_OP_SERVER; + break; + + case DOMAIN_ALIAS_RID_PRINT_OPS: + *AuthFlags |= AF_OP_PRINT; + break; + } + } + + /* Set the prvileges */ + if (bAdmin) + { + *Priv = USER_PRIV_ADMIN; + } + else if (bUser) + { + *Priv = USER_PRIV_USER; + } + else + { + *Priv = USER_PRIV_GUEST; + } + +done: + if (AliasArray != NULL) + SamFreeMemory(AliasArray); + + if (SidArray != NULL) + { + for (i = 0; i < SidCount; i++) + NetApiBufferFree(SidArray[i]); + + NetApiBufferFree(SidArray); + } + + if (GroupMembership != NULL) + SamFreeMemory(GroupMembership); + + return ApiStatus; +} + + +static +NET_API_STATUS +BuildUserInfoBuffer( + _In_ SAM_HANDLE BuiltinDomainHandle, + _In_ SAM_HANDLE UserHandle, + _In_ PSID AccountDomainSid, + _In_ ULONG RelativeId, + _In_ DWORD level, + _Out_ LPVOID *Buffer) { UNICODE_STRING LogonServer = RTL_CONSTANT_STRING(L"\\\\*"); PUSER_ALL_INFORMATION UserInfo = NULL; LPVOID LocalBuffer = NULL; PACL Dacl = NULL; + DWORD Priv = 0, AuthFlags = 0; PUSER_INFO_0 UserInfo0; PUSER_INFO_1 UserInfo1; PUSER_INFO_2 UserInfo2; @@ -444,6 +588,19 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, goto done; } + if ((level == 1) || (level == 2) || (level == 3) || + (level == 4) || (level == 11)) + { + ApiStatus = GetUserPrivileges(BuiltinDomainHandle, + UserHandle, + AccountDomainSid, + RelativeId, + &Priv, + &AuthFlags); + if (ApiStatus != NERR_Success) + goto done; + } + switch (level) { case 0: @@ -595,7 +752,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo1->usri1_password = NULL; UserInfo1->usri1_password_age = GetPasswordAge(&UserInfo->PasswordLastSet); - /* FIXME: usri1_priv */ + UserInfo1->usri1_priv = Priv; UserInfo1->usri1_home_dir = Ptr; memcpy(UserInfo1->usri1_home_dir, @@ -638,7 +795,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo2->usri2_password = NULL; UserInfo2->usri2_password_age = GetPasswordAge(&UserInfo->PasswordLastSet); - /* FIXME: usri2_priv */ + UserInfo2->usri2_priv = Priv; UserInfo2->usri2_home_dir = Ptr; memcpy(UserInfo2->usri2_home_dir, @@ -664,7 +821,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo2->usri2_script_path[UserInfo->ScriptPath.Length / sizeof(WCHAR)] = UNICODE_NULL; Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->ScriptPath.Length + sizeof(WCHAR)); - /* FIXME: usri2_auth_flags */ + UserInfo2->usri2_auth_flags = AuthFlags; UserInfo2->usri2_full_name = Ptr; memcpy(UserInfo2->usri2_full_name, @@ -757,7 +914,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo3->usri3_password = NULL; UserInfo3->usri3_password_age = GetPasswordAge(&UserInfo->PasswordLastSet); - /* FIXME: usri3_priv */ + UserInfo3->usri3_priv = Priv; UserInfo3->usri3_home_dir = Ptr; memcpy(UserInfo3->usri3_home_dir, @@ -783,7 +940,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo3->usri3_script_path[UserInfo->ScriptPath.Length / sizeof(WCHAR)] = UNICODE_NULL; Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->ScriptPath.Length + sizeof(WCHAR)); - /* FIXME: usri3_auth_flags */ + UserInfo3->usri3_auth_flags = AuthFlags; UserInfo3->usri3_full_name = Ptr; memcpy(UserInfo3->usri3_full_name, @@ -894,7 +1051,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo4->usri4_password = NULL; UserInfo4->usri4_password_age = GetPasswordAge(&UserInfo->PasswordLastSet); - /* FIXME: usri4_priv */ + UserInfo4->usri4_priv = Priv; UserInfo4->usri4_home_dir = Ptr; memcpy(UserInfo4->usri4_home_dir, @@ -920,7 +1077,7 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo4->usri4_script_path[UserInfo->ScriptPath.Length / sizeof(WCHAR)] = UNICODE_NULL; Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->ScriptPath.Length + sizeof(WCHAR)); - /* FIXME: usri4_auth_flags */ + UserInfo4->usri4_auth_flags = AuthFlags; UserInfo4->usri4_full_name = Ptr; memcpy(UserInfo4->usri4_full_name, @@ -1088,8 +1245,8 @@ BuildUserInfoBuffer(SAM_HANDLE UserHandle, UserInfo11->usri11_full_name[UserInfo->FullName.Length / sizeof(WCHAR)] = UNICODE_NULL; Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->FullName.Length + sizeof(WCHAR)); - /* FIXME: usri11_priv */ - /* FIXME: usri11_auth_flags */ + UserInfo11->usri11_priv = Priv; + UserInfo11->usri11_auth_flags = AuthFlags; UserInfo11->usri11_password_age = GetPasswordAge(&UserInfo->PasswordLastSet); @@ -2526,6 +2683,7 @@ NetUserEnum(LPCWSTR servername, LPVOID Buffer = NULL; ULONG i; SAM_HANDLE UserHandle = NULL; + ACCESS_MASK DesiredAccess; NET_API_STATUS ApiStatus = NERR_Success; NTSTATUS Status = STATUS_SUCCESS; @@ -2588,12 +2746,27 @@ NetUserEnum(LPCWSTR servername, goto done; } - Status = OpenBuiltinDomain(EnumContext->ServerHandle, - DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP, - &EnumContext->BuiltinDomainHandle); + /* Get the Builtin Domain SID */ + Status = GetBuiltinDomainSid(&EnumContext->BuiltinDomainSid); + if (!NT_SUCCESS(Status)) + { + ERR("GetBuiltinDomainSid failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + DesiredAccess = DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP; + if ((level == 1) || (level == 2) || (level == 3) || (level == 4) || (level == 11)) + DesiredAccess |= DOMAIN_GET_ALIAS_MEMBERSHIP; + + /* Open the Builtin Domain */ + Status = SamOpenDomain(EnumContext->ServerHandle, + DesiredAccess, + EnumContext->BuiltinDomainSid, + &EnumContext->BuiltinDomainHandle); if (!NT_SUCCESS(Status)) { - ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status); + ERR("SamOpenDomain failed (Status %08lx)\n", Status); ApiStatus = NetpNtStatusToApiStatus(Status); goto done; } @@ -2648,8 +2821,12 @@ NetUserEnum(LPCWSTR servername, TRACE("RID: %lu\n", CurrentUser->RelativeId); + DesiredAccess = READ_CONTROL | USER_READ_GENERAL | USER_READ_PREFERENCES | USER_READ_LOGON | USER_READ_ACCOUNT; + if ((level == 1) || (level == 2) || (level == 3) || (level == 4) || (level == 11)) + DesiredAccess |= USER_LIST_GROUPS; + Status = SamOpenUser(EnumContext->AccountDomainHandle, //BuiltinDomainHandle, - READ_CONTROL | USER_READ_GENERAL | USER_READ_PREFERENCES | USER_READ_LOGON | USER_READ_ACCOUNT, + DesiredAccess, CurrentUser->RelativeId, &UserHandle); if (!NT_SUCCESS(Status)) @@ -2659,10 +2836,11 @@ NetUserEnum(LPCWSTR servername, goto done; } - ApiStatus = BuildUserInfoBuffer(UserHandle, + ApiStatus = BuildUserInfoBuffer(EnumContext->BuiltinDomainHandle, + UserHandle, EnumContext->AccountDomainSid, - level, CurrentUser->RelativeId, + level, &Buffer); if (ApiStatus != NERR_Success) { @@ -2695,6 +2873,9 @@ done: if (EnumContext->AccountDomainHandle != NULL) SamCloseHandle(EnumContext->AccountDomainHandle); + if (EnumContext->BuiltinDomainSid != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, EnumContext->BuiltinDomainSid); + if (EnumContext->AccountDomainSid != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, EnumContext->AccountDomainSid); @@ -2909,11 +3090,14 @@ NetUserGetInfo(LPCWSTR servername, UNICODE_STRING UserName; SAM_HANDLE ServerHandle = NULL; SAM_HANDLE AccountDomainHandle = NULL; + SAM_HANDLE BuiltinDomainHandle = NULL; SAM_HANDLE UserHandle = NULL; PULONG RelativeIds = NULL; PSID_NAME_USE Use = NULL; LPVOID Buffer = NULL; PSID AccountDomainSid = NULL; + PSID BuiltinDomainSid = NULL; + ACCESS_MASK DesiredAccess; NET_API_STATUS ApiStatus = NERR_Success; NTSTATUS Status = STATUS_SUCCESS; @@ -2937,6 +3121,31 @@ NetUserGetInfo(LPCWSTR servername, goto done; } + /* Get the Builtin Domain SID */ + Status = GetBuiltinDomainSid(&BuiltinDomainSid); + if (!NT_SUCCESS(Status)) + { + ERR("GetBuiltinDomainSid failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + DesiredAccess = DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP; + if ((level == 1) || (level == 2) || (level == 3) || (level == 4) || (level == 11)) + DesiredAccess |= DOMAIN_GET_ALIAS_MEMBERSHIP; + + /* Open the Builtin Domain */ + Status = SamOpenDomain(ServerHandle, + DesiredAccess, + BuiltinDomainSid, + &BuiltinDomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("SamOpenDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + /* Get the Account Domain SID */ Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL, &AccountDomainSid); @@ -2985,9 +3194,13 @@ NetUserGetInfo(LPCWSTR servername, TRACE("RID: %lu\n", RelativeIds[0]); + DesiredAccess = READ_CONTROL | USER_READ_GENERAL | USER_READ_PREFERENCES | USER_READ_LOGON | USER_READ_ACCOUNT; + if ((level == 1) || (level == 2) || (level == 3) || (level == 4) || (level == 11)) + DesiredAccess |= USER_LIST_GROUPS; + /* Open the user object */ Status = SamOpenUser(AccountDomainHandle, - READ_CONTROL | USER_READ_GENERAL | USER_READ_PREFERENCES | USER_READ_LOGON | USER_READ_ACCOUNT, + DesiredAccess, RelativeIds[0], &UserHandle); if (!NT_SUCCESS(Status)) @@ -2997,10 +3210,11 @@ NetUserGetInfo(LPCWSTR servername, goto done; } - ApiStatus = BuildUserInfoBuffer(UserHandle, + ApiStatus = BuildUserInfoBuffer(BuiltinDomainHandle, + UserHandle, AccountDomainSid, - level, RelativeIds[0], + level, &Buffer); if (ApiStatus != NERR_Success) { @@ -3024,6 +3238,12 @@ done: if (AccountDomainSid != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, AccountDomainSid); + if (BuiltinDomainHandle != NULL) + SamCloseHandle(BuiltinDomainHandle); + + if (BuiltinDomainSid != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, BuiltinDomainSid); + if (ServerHandle != NULL) SamCloseHandle(ServerHandle);
5 years, 9 months
1
0
0
0
[reactos] 01/01: [USERENV] Store the profiles load time, flags and state in the profile list.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cf6a5d6e7c6a1b69f6554…
commit cf6a5d6e7c6a1b69f6554d298a3e9848cccc603f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Mar 16 19:12:25 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Mar 16 19:13:15 2019 +0100 [USERENV] Store the profiles load time, flags and state in the profile list. --- dll/win32/userenv/profile.c | 107 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c index 1c18a67ab6..bd859cc21c 100644 --- a/dll/win32/userenv/profile.c +++ b/dll/win32/userenv/profile.c @@ -348,6 +348,109 @@ done: } +static +DWORD +SetProfileData( + _In_ PWSTR pszSidString, + _In_ DWORD dwFlags, + _In_ HANDLE hToken) +{ + HKEY hProfilesKey = NULL, hProfileKey = NULL; + FILETIME LoadTime; + DWORD dwLength, dwState = 0; + DWORD dwError; + + DPRINT("SetProfileData(%S %p)\n", + pszSidString, hToken); + + dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", + 0, + KEY_QUERY_VALUE, + &hProfilesKey); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + + dwError = RegOpenKeyExW(hProfilesKey, + pszSidString, + 0, + KEY_QUERY_VALUE | KEY_SET_VALUE, + &hProfileKey); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + + /* Set the profile load time */ + GetSystemTimeAsFileTime(&LoadTime); + + dwLength = sizeof(LoadTime.dwLowDateTime); + dwError = RegSetValueExW(hProfileKey, + L"ProfileLoadTimeLow", + 0, + REG_DWORD, + (PBYTE)&LoadTime.dwLowDateTime, + dwLength); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + + dwLength = sizeof(LoadTime.dwHighDateTime); + dwError = RegSetValueExW(hProfileKey, + L"ProfileLoadTimeHigh", + 0, + REG_DWORD, + (PBYTE)&LoadTime.dwHighDateTime, + dwLength); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + + dwLength = sizeof(dwFlags); + dwError = RegSetValueExW(hProfileKey, + L"Flags", + 0, + REG_DWORD, + (PBYTE)&dwFlags, + dwLength); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + + dwLength = sizeof(dwState); + dwError = RegSetValueExW(hProfileKey, + L"State", + 0, + REG_DWORD, + (PBYTE)&dwState, + dwLength); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("Error: %lu\n", dwError); + goto done; + } + +done: + if (hProfileKey != NULL) + RegCloseKey(hProfileKey); + + if (hProfilesKey != NULL) + RegCloseKey(hProfilesKey); + + return dwError; +} + + /* PUBLIC FUNCTIONS ********************************************************/ BOOL @@ -1749,6 +1852,10 @@ LoadUserProfileW( SetLastError((DWORD)Error); goto cleanup; } + + SetProfileData(SidString.Buffer, + lpProfileInfo->dwFlags, + hToken); } /* Open future HKEY_CURRENT_USER */
5 years, 9 months
1
0
0
0
[reactos] 01/01: [SHELL32] Disable the Hardware tab in the properties dialog for Network drives (#1249)
by Jared Smudde
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6707efc5346e1cdaad367…
commit 6707efc5346e1cdaad367422b850275329e6c885 Author: Jared Smudde <computerwhiz02(a)hotmail.com> AuthorDate: Sat Mar 16 09:37:56 2019 -0500 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sat Mar 16 15:37:56 2019 +0100 [SHELL32] Disable the Hardware tab in the properties dialog for Network drives (#1249) This matches Windows behaviour. --- dll/win32/shell32/dialogs/drvdefext.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dll/win32/shell32/dialogs/drvdefext.cpp b/dll/win32/shell32/dialogs/drvdefext.cpp index ef4c2c6b7c..09e1796583 100644 --- a/dll/win32/shell32/dialogs/drvdefext.cpp +++ b/dll/win32/shell32/dialogs/drvdefext.cpp @@ -648,12 +648,15 @@ CDrvDefExt::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) pfnAddPage(hPage, lParam); } - hPage = SH_CreatePropertySheetPage(IDD_DRIVE_HARDWARE, - HardwarePageProc, - (LPARAM)this, - NULL); - if (hPage) - pfnAddPage(hPage, lParam); + if (GetDriveTypeW(m_wszDrive) != DRIVE_REMOTE) + { + hPage = SH_CreatePropertySheetPage(IDD_DRIVE_HARDWARE, + HardwarePageProc, + (LPARAM)this, + NULL); + if (hPage) + pfnAddPage(hPage, lParam); + } return S_OK; }
5 years, 9 months
1
0
0
0
[reactos] 01/01: [MEDIA][INF] Improve network adapter names
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c6690034187dccac5aa79…
commit c6690034187dccac5aa79430e1a7d6ae04012a43 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Sat Mar 9 21:00:54 2019 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sat Mar 16 15:35:15 2019 +0100 [MEDIA][INF] Improve network adapter names --- media/inf/netamd.inf | 2 +- media/inf/nete1000.inf | 112 ++++++++++++++++++++++++++++++++----------------- media/inf/netisa.inf | 2 +- media/inf/netrtl.inf | 10 ++--- media/inf/netrtpnt.inf | 2 +- 5 files changed, 82 insertions(+), 46 deletions(-) diff --git a/media/inf/netamd.inf b/media/inf/netamd.inf index 2e799de834..00f361c99a 100644 --- a/media/inf/netamd.inf +++ b/media/inf/netamd.inf @@ -59,7 +59,7 @@ LoadOrderGroup = NDIS ReactOS = "ReactOS Team" AMDMfg = "Advanced Micro Devices (AMD)" -PCNET.DeviceDesc = "AMD 79c970 [PCnet32 LANCE]" +PCNET.DeviceDesc = "AMD PCnet Am79C970 PCI Ethernet Adapter" [Strings.0a] ReactOS = "Equipo de ReactOS" diff --git a/media/inf/nete1000.inf b/media/inf/nete1000.inf index 9eabcecfad..128d86cdde 100644 --- a/media/inf/nete1000.inf +++ b/media/inf/nete1000.inf @@ -18,43 +18,43 @@ DefaultDestDir = 12 %IntelMfg% = IntelMfg [IntelMfg] -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1000 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1001 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1004 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1008 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1009 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100A -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100C -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100D -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100E -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100F -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1010 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1011 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1012 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1013 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1014 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1015 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1016 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1017 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1018 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1019 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_101A -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_101D -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_101E -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1026 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1027 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1028 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1075 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1076 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1077 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1078 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1079 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_107A -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_107B -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_107C -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_108A -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1099 -%IntelE1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_10B5 +%IntelE1000_1000.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1000 +%IntelE1000_1001.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1001 +%IntelE1000_1004.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1004 +%IntelE1000_1008.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1008 +%IntelE1000_1009.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1009 +%IntelE1000_100A.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100A +%IntelE1000_100C.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100C +%IntelE1000_100D.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100D +%IntelE1000_100E.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100E +%IntelE1000_100F.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_100F +%IntelE1000_1010.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1010 +%IntelE1000_1011.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1011 +%IntelE1000_1012.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1012 +%IntelE1000_1013.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1013 +%IntelE1000_1014.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1014 +%IntelE1000_1015.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1015 +%IntelE1000_1016.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1016 +%IntelE1000_1017.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1017 +%IntelE1000_1018.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1018 +%IntelE1000_1019.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1019 +%IntelE1000_101A.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_101A +%IntelE1000_101D.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_101D +%IntelE1000_101E.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_101E +%IntelE1000_1026.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1026 +%IntelE1000_1027.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1027 +%IntelE1000_1028.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1028 +%IntelE1000_1075.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1075 +%IntelE1000_1076.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1076 +%IntelE1000_1077.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1077 +%IntelE1000_1078.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1078 +%IntelE1000_1079.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1079 +%IntelE1000_107A.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_107A +%IntelE1000_107B.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_107B +%IntelE1000_107C.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_107C +%IntelE1000_108A.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_108A +%IntelE1000_1099.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_1099 +%IntelE1000_10B5.DeviceDesc% = E1000_Inst.ndi,PCI\VEN_8086&DEV_10B5 ;----------------------------- E1000 DRIVER ----------------------------- @@ -83,4 +83,40 @@ ReactOS = "ReactOS Team" IntelMfg = "Intel" -IntelE1000.DeviceDesc = "Intel PRO/1000 Ethernet Adapter" +IntelE1000_1000.DeviceDesc = "Intel 82542-based PCI Ethernet Adapter" +IntelE1000_1001.DeviceDesc = "Intel 82543GC Fiber PCI Ethernet Adapter" +IntelE1000_1004.DeviceDesc = "Intel 82543GC Copper PCI Ethernet Adapter" +IntelE1000_1008.DeviceDesc = "Intel 82544EI Copper PCI-X Ethernet Adapter" +IntelE1000_1009.DeviceDesc = "Intel 82544EI Fiber PCI-X Ethernet Adapter" +IntelE1000_100A.DeviceDesc = "Intel 82540EM PCI Ethernet Adapter" +IntelE1000_100C.DeviceDesc = "Intel 82544GC Copper PCI Ethernet Adapter" +IntelE1000_100D.DeviceDesc = "Intel 82544GC Integrated PCI Ethernet Adapter" +IntelE1000_100E.DeviceDesc = "Intel 82540EM PCI Ethernet Adapter" +IntelE1000_100F.DeviceDesc = "Intel 82545EM Copper PCI-X Ethernet Adapter" +IntelE1000_1010.DeviceDesc = "Intel 82546EB Copper PCI-X Ethernet Adapter" +IntelE1000_1011.DeviceDesc = "Intel 82545EM Fiber PCI-X Ethernet Adapter" +IntelE1000_1012.DeviceDesc = "Intel 82546EB Fiber PCI-X Ethernet Adapter" +IntelE1000_1013.DeviceDesc = "Intel 82541EI PCI Ethernet Adapter" +IntelE1000_1014.DeviceDesc = "Intel 82541EI Integrated PCI Ethernet Adapter" +IntelE1000_1015.DeviceDesc = "Intel 82540EM Integrated PCI Ethernet Adapter" +IntelE1000_1016.DeviceDesc = "Intel 82540EP Integrated PCI Ethernet Adapter" +IntelE1000_1017.DeviceDesc = "Intel 82540EP PCI Ethernet Adapter" +IntelE1000_1018.DeviceDesc = "Intel 82541EI Mobile PCI Ethernet Adapter" +IntelE1000_1019.DeviceDesc = "Intel 82547EI PCI Ethernet Adapter" +IntelE1000_101A.DeviceDesc = "Intel 82547EI Mobile PCI Ethernet Adapter" +IntelE1000_101D.DeviceDesc = "Intel 82546EB Quad Copper PCI-X Ethernet Adapter" +IntelE1000_101E.DeviceDesc = "Intel 82540EP Low Profile PCI Ethernet Adapter" +IntelE1000_1026.DeviceDesc = "Intel 82545GM Copper PCI-X Ethernet Adapter" +IntelE1000_1027.DeviceDesc = "Intel 82545GM Fiber PCI-X Ethernet Adapter" +IntelE1000_1028.DeviceDesc = "Intel 82545GM SerDes PCI Ethernet Adapter" +IntelE1000_1075.DeviceDesc = "Intel 82547GI PCI Ethernet Adapter" +IntelE1000_1076.DeviceDesc = "Intel 82541GI PCI Ethernet Adapter" +IntelE1000_1077.DeviceDesc = "Intel 82541GI Mobile PCI Ethernet Adapter" +IntelE1000_1078.DeviceDesc = "Intel 82541ER PCI Ethernet Adapter" +IntelE1000_1079.DeviceDesc = "Intel 82546GB Copper PCI-X Ethernet Adapter" +IntelE1000_107A.DeviceDesc = "Intel 82546GB Fiber PCI Ethernet Adapter" +IntelE1000_107B.DeviceDesc = "Intel 82546GB SerDes PCI Ethernet Adapter" +IntelE1000_107C.DeviceDesc = "Intel 82541PI PCI Ethernet Adapter" +IntelE1000_108A.DeviceDesc = "Intel 82546GB PCI-E Ethernet Adapter" +IntelE1000_1099.DeviceDesc = "Intel 82546GB Quad Copper PCI Ethernet Adapter" +IntelE1000_10B5.DeviceDesc = "Intel 82546GB Quad Copper KSP3 PCI-X Ethernet Adapter" diff --git a/media/inf/netisa.inf b/media/inf/netisa.inf index 2f967014dd..a9532686d2 100644 --- a/media/inf/netisa.inf +++ b/media/inf/netisa.inf @@ -52,7 +52,7 @@ LoadOrderGroup = NDIS ReactOS = "ReactOS Team" GenericMfg = "(Generic network cards)" -*PNP80D6.DeviceDesc = "NE2000 Compatible" +*PNP80D6.DeviceDesc = "NE2000 Compatible ISA Ethernet Adapter" [Strings.0405] GenericMfg = "(Generické síťové karty)" diff --git a/media/inf/netrtl.inf b/media/inf/netrtl.inf index eefe905152..4e8c358863 100644 --- a/media/inf/netrtl.inf +++ b/media/inf/netrtl.inf @@ -69,11 +69,11 @@ DLinkMfg = "D-Link" LevelOneMfg = "LevelOne" CompaqMfg = "Compaq" -Realtek8139.DeviceDesc = "Realtek RTL8139 Ethernet Adapter" -AcctonEN1207D.DeviceDesc = "Accton EN-1207D (RTL8139) Ethernet Adapter" -DLinkDFE538TX.DeviceDesc = "D-Link DFE-538TX (RTL8139) Ethernet Adapter" -LevelOneFPC0106TX.DeviceDesc = "LevelOne FPC-0106Tx (RTL8139) Ethernet Adapter" -CompaqHNE300.DeviceDesc = "Compaq HNE-300 (RTL8139C) Ethernet Adapter" +Realtek8139.DeviceDesc = "Realtek RTL8139 PCI Ethernet Adapter" +AcctonEN1207D.DeviceDesc = "Accton EN-1207D (RTL8139) PCI Ethernet Adapter" +DLinkDFE538TX.DeviceDesc = "D-Link DFE-538TX (RTL8139) PCI Ethernet Adapter" +LevelOneFPC0106TX.DeviceDesc = "LevelOne FPC-0106Tx (RTL8139) PCI Ethernet Adapter" +CompaqHNE300.DeviceDesc = "Compaq HNE-300 (RTL8139C) PCI Ethernet Adapter" [Strings.0a] ReactOS = "Equipo de ReactOS" diff --git a/media/inf/netrtpnt.inf b/media/inf/netrtpnt.inf index af93d70925..14723ccf10 100644 --- a/media/inf/netrtpnt.inf +++ b/media/inf/netrtpnt.inf @@ -52,7 +52,7 @@ LoadOrderGroup = NDIS ReactOS = "ReactOS Team" RealtekMfg = "Realtek Semiconductor Co., Ltd." -PCI\VEN_10EC&DEV_8029.DeviceDesc = "RTL-8029(AS)" +PCI\VEN_10EC&DEV_8029.DeviceDesc = "Realtek RTL8029 PCI Ethernet Adapter" [Strings.0a] ReactOS = "Equipo de ReactOS"
5 years, 9 months
1
0
0
0
[reactos] 01/01: [SNDVOL32] Small Italian translation update (#1415)
by Daniele Campione
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ee65350fcf82263f7f5ed…
commit ee65350fcf82263f7f5edfcd40e36fede2d392b9 Author: Daniele Campione <nonametekno(a)gmail.com> AuthorDate: Sat Mar 16 15:33:57 2019 +0100 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sat Mar 16 15:33:57 2019 +0100 [SNDVOL32] Small Italian translation update (#1415) --- base/applications/sndvol32/lang/it-IT.rc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/base/applications/sndvol32/lang/it-IT.rc b/base/applications/sndvol32/lang/it-IT.rc index 42db02aa91..409f37ca52 100644 --- a/base/applications/sndvol32/lang/it-IT.rc +++ b/base/applications/sndvol32/lang/it-IT.rc @@ -39,7 +39,7 @@ BEGIN AUTORADIOBUTTON "&Registrazione", IDC_RECORDING, 13, 61, 58, 8 AUTORADIOBUTTON "&Altro:", IDC_OTHER, 13, 80, 42, 8, WS_DISABLED COMBOBOX IDC_LINE, 55, 80, 155, 50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - LTEXT "Mostra i controlli di volume seguenti:", IDC_LABELCONTROLS, 7, 109, 162, 8 + LTEXT "Mostra i seguenti controlli di volume:", IDC_LABELCONTROLS, 7, 109, 162, 8 CONTROL "", IDC_CONTROLS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | WS_TABSTOP | WS_BORDER, 7, 122, 211, 96 PUSHBUTTON "OK", IDOK, 114, 226, 50, 14 PUSHBUTTON "Annulla", IDCANCEL, 168, 226, 50, 14 @@ -58,7 +58,7 @@ BEGIN LTEXT "Volume", -1, 4, 58, 80, 8 CONTROL "", IDC_LINE_SLIDER_VERT, "msctls_trackbar32", TBS_VERT | TBS_BOTH | TBS_DOWNISLEFT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 67, 30, 56 AUTOCHECKBOX "&Disattiva", IDC_LINE_SWITCH, 4, 123, 55, 12 - PUSHBUTTON "&Advanced", IDC_LINE_ADVANCED, 4, 138, 80, 14, WS_TABSTOP + PUSHBUTTON "&Avanzate", IDC_LINE_ADVANCED, 4, 138, 80, 14, WS_TABSTOP CONTROL "", IDC_LINE_SEP, "static", SS_ETCHEDVERT | WS_CHILD | WS_VISIBLE, 90, 1, 1, 137 END @@ -75,7 +75,7 @@ BEGIN LTEXT "Volume", -1, 4, 58, 60, 8 CONTROL "", IDC_LINE_SLIDER_VERT, "msctls_trackbar32", TBS_VERT | TBS_BOTH | TBS_DOWNISLEFT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 67, 30, 56 AUTOCHECKBOX "&Disattiva", IDC_LINE_SWITCH, 4, 123, 55, 12 - PUSHBUTTON "&Advanced", IDC_LINE_ADVANCED, 7, 138, 55, 14, WS_TABSTOP + PUSHBUTTON "&Avanzate", IDC_LINE_ADVANCED, 7, 138, 55, 14, WS_TABSTOP CONTROL "", IDC_LINE_SEP, "static", SS_ETCHEDVERT | WS_CHILD | WS_VISIBLE, 70, 25, 1, 113 END @@ -113,24 +113,24 @@ END IDD_ADVANCED DIALOGEX 0, 0, 255, 140 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Advanced Controls for Volume Control" +CAPTION "Controlli avanzati per il volume" FONT 8, "MS Shell Dlg" BEGIN CONTROL IDI_MAINAPP, -1, "static", SS_ICON | WS_CHILD | WS_VISIBLE, 7, 7, 32, 32 - LTEXT "These settings can be used to make fine adjustments to your audio.", -1, 44, 7, 200, 32 - GROUPBOX "Tone Controls", IDC_ADV_TONE_CONTROLS, 7, 33, 240, 80 - LTEXT "These settings control how the tone of your audio sounds.", -1, 17, 48, 200, 14 - LTEXT "&Bass:", -1, 17, 62, 50, 8 - LTEXT "Low", IDC_ADV_BASS_LOW, 77, 62, 20, 8 - LTEXT "High", IDC_ADV_BASS_HIGH, 182, 62, 20, 8 + LTEXT "Queste impostazioni possono essere usate per fare regolazioni fini al tuo audio.", -1, 44, 7, 200, 32 + GROUPBOX "Controlli di tono", IDC_ADV_TONE_CONTROLS, 7, 33, 240, 80 + LTEXT "Queste impostazioni controllano il modo in cui suona il tono del tuo audio.", -1, 17, 48, 200, 14 + LTEXT "&Basso:", -1, 17, 62, 50, 8 + LTEXT "Basso", IDC_ADV_BASS_LOW, 77, 62, 20, 8 + LTEXT "Alto", IDC_ADV_BASS_HIGH, 182, 62, 20, 8 CONTROL "", IDC_ADV_BASS_SLIDER, "msctls_trackbar32", TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 97, 62, 80, 20 - LTEXT "&Treble:", -1, 17, 90, 50, 8 - LTEXT "Low", IDC_ADV_TREBLE_LOW, 77, 90, 20, 8 - LTEXT "High", IDC_ADV_TREBLE_HIGH, 182, 90, 20, 8 + LTEXT "&Alto:", -1, 17, 90, 50, 8 + LTEXT "Basso", IDC_ADV_TREBLE_LOW, 77, 90, 20, 8 + LTEXT "Alto", IDC_ADV_TREBLE_HIGH, 182, 90, 20, 8 CONTROL "", IDC_ADV_TREBLE_SLIDER, "msctls_trackbar32", TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 97, 90, 80, 20 - GROUPBOX "Other Controls", IDC_ADV_OTHER_CONTROLS, 7, 119, 240, 66 - LTEXT "These settings make other changes to how your audio sounds. See your hardware documentation for details.", IDC_ADV_OTHER_TEXT, 17, 135, 220, 28 + GROUPBOX "Altri controlli", IDC_ADV_OTHER_CONTROLS, 7, 119, 240, 66 + LTEXT "Queste impostazioni apportano ulteriori cambiamenti al modo in cui suona il tuo audio. Vedi la tua documentazione hardware per i dettagli.", IDC_ADV_OTHER_TEXT, 17, 135, 220, 28 AUTOCHECKBOX "&1 ", IDC_ADV_OTHER_CHECK1, 17, 159, 220, 14 AUTOCHECKBOX "&2 ", IDC_ADV_OTHER_CHECK2, 17, 174, 220, 14 - DEFPUSHBUTTON "Close", IDOK, 197, 120, 50, 14, WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "Chiudi", IDOK, 197, 120, 50, 14, WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP END
5 years, 9 months
1
0
0
0
[reactos] 01/01: Merge pull request #1253 from SergeGautherie/SergeGautherie/PRonly_Log2Lines_handle_escape_cmd_Path-LineOut
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1631f37404d57341dc05e…
commit 1631f37404d57341dc05ed219029b2f38010fd5e Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Sat Mar 16 11:23:27 2019 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sat Mar 16 11:23:27 2019 +0100 Merge pull request #1253 from SergeGautherie/SergeGautherie/PRonly_Log2Lines_handle_escape_cmd_Path-LineOut [LOG2LINES] handle_escape_cmd(): Remove 2 unused parameters --- sdk/tools/log2lines/cmd.c | 2 +- sdk/tools/log2lines/cmd.h | 2 +- sdk/tools/log2lines/log2lines.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/tools/log2lines/cmd.c b/sdk/tools/log2lines/cmd.c index 5a817a3e18..6fd8566a46 100644 --- a/sdk/tools/log2lines/cmd.c +++ b/sdk/tools/log2lines/cmd.c @@ -177,7 +177,7 @@ handle_address_cmd(FILE *outFile, char *arg) } char -handle_escape_cmd(FILE *outFile, char *Line, char *path, char *LineOut) +handle_escape_cmd(FILE *outFile, char *Line) { char cmd; char sep = '\n'; diff --git a/sdk/tools/log2lines/cmd.h b/sdk/tools/log2lines/cmd.h index c2380b2b89..0307809e0f 100644 --- a/sdk/tools/log2lines/cmd.h +++ b/sdk/tools/log2lines/cmd.h @@ -18,6 +18,6 @@ #define KDBG_CONT "---" //Also after this pattern (prompt with no line ending) #define KDBG_DISCARD "Command '" KDBG_ESC_STR //Discard responses at l2l escape commands -char handle_escape_cmd(FILE *outFile, char *Line, char *path, char *LineOut); +char handle_escape_cmd(FILE *outFile, char *Line); /* EOF */ diff --git a/sdk/tools/log2lines/log2lines.c b/sdk/tools/log2lines/log2lines.c index b5ff009c38..5495521057 100644 --- a/sdk/tools/log2lines/log2lines.c +++ b/sdk/tools/log2lines/log2lines.c @@ -439,7 +439,7 @@ translate_files(FILE *inFile, FILE *outFile) } else { - Line[1] = handle_escape_cmd(outFile, Line, path, LineOut); + Line[1] = handle_escape_cmd(outFile, Line); if (Line[1] != KDBG_ESC_CHAR) { if (p == p_eos)
5 years, 9 months
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
22
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Results per page:
10
25
50
100
200